开发者

getting emacs to move cursor by words on a Mac

It's supposed to be M + cursor, but any shortcut in emacs using M (escape) on my mac sucks, because every time i need to use it, i need to release M (the escape key) and then press it again. Is there a better shortcut for moving along words in emacs (kind of like ctr + arrow in windo开发者_运维知识库ws?)


There is an setting in Terminal's preferences to use the option key as meta, under settings/keyboard, then you can use option-arrow or option-f to move forward by words.


At least for me forward/backward word is bound by default to M-right/left(arrow), C-right/left(arrow) and of course M-f/b. If this is not the case for you you can do something like this:

(global-set-key (kbd "C-right") 'forward-word)
(global-set-key (kbd "C-left") 'backward-word)

Place this code in .emacs or .emacs.d/init.el and you should be fine.


You can change the Meta key to Alt, Command, or Caps Lock. Take a look at this EmacsWiki article.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜