Rebind emacs“C-d”删除单词 [英] Rebind emacs "C-d" to delete word
本文介绍了Rebind emacs“C-d”删除单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以借给我一个手吗?
解决方案
(add-hook'c-initialization-hook
(lambda()
(define-key c ++ - mode-map\Cd'kill-word)
(define-key c ++ - mode-map\Md'c-electric -delete-forward)))
从:
变量: c-initialization-hook
当CC模式初始化时,每个Emacs会话只挂钩一次。这是在任何CC模式键映射中更改键绑定(或添加新键)的好地方。请参阅示例.emacs文件。
I have tried several different ways of doing this, and none have been successful. I want to switch the M-d and C-d functionality (delete word, delete char) respectively while working in c++ files.
Can someone please lend me a hand?
解决方案
(add-hook 'c-initialization-hook
(lambda ()
(define-key c++-mode-map "\C-d" 'kill-word)
(define-key c++-mode-map "\M-d" 'c-electric-delete-forward)))
From CC Hooks - CC Mode Manulal:
Variable: c-initialization-hook
Hook run only once per Emacs session, when CC Mode is initialized. This is a good place to change key bindings (or add new ones) in any of the CC Mode key maps. See Sample .emacs File.
这篇关于Rebind emacs“C-d”删除单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文