我正在尝试ErgoEmacs模式,看看我是否可以更舒适地使用Emacs。它的一些键绑定相当直观,但在许多情况下,我不想直接替换默认设置。
例如,在ErgoEmacs的导航快捷方式结构的上下文中,M-h作为C-a的替代是有意义的--但我希望能够同时使用两者,而不仅仅是M-h。我尝试简单地复制命令:
;; Move to beginning/ending of line
(defconst ergoemacs-move-beginning-of-line-key (kbd "C-a")) ; original
(defconst ergoemacs-move-end-of-line-key (kbd "C-e")) ; original
(defconst ergoemacs-move-beginning-of-line-key (kbd "M-h")) ; ergoemacs
(defconst ergoemacs-move-end-of-line-key (kbd "M-H")) ; ergoemacs但是Emacs只是用第二个键绑定覆盖了第一个键绑定。解决这个问题的最好方法是什么?
发布于 2010-06-16 05:33:54
事实证明,ErgoEmacs使用两个文件来定义键绑定。一个是主ergoemacs-mode.el文件,另一个是您选择的特定键盘布局(例如ergoemacs-layout-us.el).后一个文档创建一个常量,前者使用该常量创建键绑定。因此,当我认为我正在复制键绑定时,实际上我正在更改随后用于该目的的常量。
解决方案:
在ergomacs-mode.el中:
;; Move to beginning/ending of line
(define-key ergoemacs-keymap ergoemacs-move-beginning-of-line-key 'move-beginning-of-line)
(define-key ergoemacs-keymap ergoemacs-move-end-of-line-key 'move-end-of-line)
(define-key ergoemacs-keymap ergoemacs-move-beginning-of-line-key2 'move-beginning-of-line) ; new
(define-key ergoemacs-keymap ergoemacs-move-end-of-line-key2 'move-end-of-line) ; new在ergoemacs-layout-us.el中:
;; Move to beginning/ending of line
(defconst ergoemacs-move-beginning-of-line-key (kbd "M-h"))
(defconst ergoemacs-move-end-of-line-key (kbd "M-H"))
(defconst ergoemacs-move-beginning-of-line-key2 (kbd "C-a")) ; new
(defconst ergoemacs-move-end-of-line-key2 (kbd "C-e")) ; new发布于 2010-06-16 06:38:48
重新发布来自ergo-emacs mailing list的回复
Xah Lee说:
,这很简单。
在ergoemacs-mode.el文件中,有一行代码(load "ergoemacs-unbind")注释掉它。这应该就是您需要做的全部工作。但是,请注意,ErgoEmacs快捷键定义了一些常见的快捷键,如打开、关闭、新建、保存...使用关键字Ctrl+o、Ctrl+w、Ctrl+n、Ctrl+s等,大约7个左右。所以,我认为其中一些会影响emacs与Ctrl的传统绑定。如果您是ErgoEmacs的新手并试图探索它,那么您可以尝试从几个关键字开始。这个页面可能包含一些有用的信息:http://code.google.com/p/ergoemacs/wiki/adoption,感谢您查看ErgoEmacs!
Xah http://xahlee.org/∑
发布于 2010-06-16 03:27:21
哈?每个函数都有且只有一种方法是ErgoEmacs的黄金法则吗?因为普通的键绑定的工作方式正好相反:您一次命名一个键,并指定它应该做什么。如果模式定义了一个全局变量来表示“行尾绑定到的键”,那么当然只能有一个值,但是使用普通的绑定命令,您可以将相同的函数绑定到任意多个组合。事实上,我所见过的每个快捷键绑定看起来都像这样
(global-set-key [(meta space)] 'just-one-space)或者像这样
(add-hook 'c-mode-hook 'my-c-mode-hook)
(defun my-c-mode-hook ()
(define-key c-mode-map [(control c) b] 'c-insert-block))如果它只用于特定的模式。
https://stackoverflow.com/questions/3048230
复制相似问题