4
votes

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!

2
Your question isn't very clear as to what you're asking—are you looking to edit those two specific key bindings? Are you asking how to change the alt key to do something else? Or are you looking for an emacs-ify plugin? Whatever your meaning was, the Sublemacs Pro plugin should help you.angerson
Okay I've clarified the question. This definitely helps a lot. Please post it as an answer.WattsInABox
Great! I've added my discovery of Sublemacs as an answer.angerson
I just wanted to note here that now on SublimeText3 without all my old plugins, everything seems to be working fine without Sublemacs Pro. I think a plugin might've borked it or sublime 2 OOTB comes borked for free. :)WattsInABox

2 Answers

2
votes

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.

4
votes

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.