我正在尝试将C-y重新绑定到重做。 我尝试了所有可能的选择:
(global-unset-key(kbd“C-y”)),在组织模式钩子的外部和内部, 和(define-key org-mode-map(kbd“C-y”)nil)。
然而没什么。在OrgMode之外,它的表现非常好,但在里面?它猛拉了。 这实际上并不是每当我在OrgMode中时,第一个KeyBinding不起作用, 这让我很难过。
请帮助。
答案 0 :(得分:3)
在神话般的phils的快速帮助下,我偶然发现了两件事: Globally override key binding in Emacs 我目前使用的,和 http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/ 我肯定会尽快阅读。
感谢Phils;)
我目前的设置是:
(defvar custom-keys-mode-map (make-keymap) "custom-keys-mode keymap.")
(define-minor-mode custom-keys-mode
"A minor mode so that my key settings override annoying major modes."
t " my-keys" 'custom-keys-mode-map)
(custom-keys-mode 1)
(defun my-minibuffer-setup-hook ()
(custom-keys-mode 0))
(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
(defadvice load (after give-my-keybindings-priority)
"Try to ensure that my keybindings always have priority."
(if (not (eq (car (car minor-mode-map-alist)) 'custom-keys-mode))
(let ((mykeys (assq 'custom-keys-mode minor-mode-map-alist)))
(assq-delete-all 'custom-keys-mode minor-mode-map-alist)
(add-to-list 'minor-mode-map-alist mykeys))))
(ad-activate 'load)
(define-key custom-keys-mode-map (kbd "<C-key>") 'some-command)