开发者

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

开发者 https://www.devze.com 2023-02-07 02:16 出处:网络
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 does

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

精彩评论

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