简体   繁体   中英

Change behavior of Alt key in Sublime Text 2

I want to be able to use the alt key in Sublime Text 2 like I can use it on the command line in iTerm. For example, when I hit alt+f , the cursor moves forward a word, or when I hit alt+b , the cursor moves backward a word.

Instead, what happens is UTF+8 characters corresponding to the keys get inserted (ex: ƒ or ). In iTerm on the Mac, I can change the left alt behavior to act like +esc and it seems to do the trick.

This could either be a Mac OS X problem in general (I have the same problem in the web browser) or something specific with Sublime Text 2 so I would appreciate any Mac or Sublime Text 2 expertise. Thanks!

After using Sublemacs Pro for a few days, I realized it does too much for my liking, although it may be fine for more seasoned emacs users.

I come from TextMate and what I really want is the best of all worlds: mostly Sublime shortcuts, a few missing shortcuts from Textmate's ruby library of shortcuts, and a few shortcuts that Textmate stole from emacs.

So, I figured out how to solve the alt+f and alt+b problems:

{ "keys": ["alt+b"], "command": "move", "args": {"by": "subwords", "forward": false} },
{ "keys": ["alt+f"], "command": "move", "args": {"by": "subword_ends", "forward": true} }

If I find some more really useful ones, I'll post them here. Also, if I find a resource that lists all the possible "by" field values, I'll post that, as well.

There is a Sublime Text 2 plugin called Sublemacs Pro that provides emacs-like keybindings and operations, including those that you mentioned pining for. You can find installation instructions and the complete keybinding reference on the Github page .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM