禁用emacs中的箭头键


9

我想避免在emacs中使用箭头键进行导航,但是由于习惯,很难切换到emacs的本机键绑定进行导航。我想禁用箭头键,以完全避免它。如何在Emacs中禁用箭头键?


1
禁用光标是一回事,但是进行C-s C-r搜索样式导航会更好。
ocodo 2012年

Answers:


10

将此Elisp代码放在~/.emacs启动文件的底部:

(global-unset-key (kbd "<left>"))
(global-unset-key (kbd "<right>"))
(global-unset-key (kbd "<up>"))
(global-unset-key (kbd "<down>"))
(global-unset-key (kbd "<C-left>"))
(global-unset-key (kbd "<C-right>"))
(global-unset-key (kbd "<C-up>"))
(global-unset-key (kbd "<C-down>"))
(global-unset-key (kbd "<M-left>"))
(global-unset-key (kbd "<M-right>"))
(global-unset-key (kbd "<M-up>"))
(global-unset-key (kbd "<M-down>"))

然后重新启动Emacs。如果您不想禁用Ctrl(C-)和Alt(M-)变体,只需将这些部分留在外面即可。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.