开发者

How do you move the prefix argument to a different key in Emacs?

I'm using an alternate keyboard layout (Colemak) and I want to move the universal-argument command to a different key in Emacs, C-l instead of C-u. I t开发者_开发知识库ried the following, but it doesn't let me chain multiple universal arguments together multiplicatively (C-l C-l C-l) and it breaks C-l C-u too (which should move up 4 lines):

(global-set-key "\C-l" 'universal-argument)
(global-set-key "\C-u" 'previous-line)


When you use the prefix argument, Emacs uses a keymap temporarily to handle the universal argument functionality. So, you need to make the changes you've made there too:

(define-key universal-argument-map "\C-l" 'universal-argument-more)
(define-key universal-argument-map "\C-u" nil)

The first sets up C-l to be the continuation of universal-argument, and the second un-defines the C-u from that map b/c you no longer want it to be the universal argument.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜