Setting up Sublime Text 2 Custom Keyboard Shortcuts

sublime-text-2

I'm a Vim user trying to move to Sublime Text 2, as it's faster than MacVim with a bunch of stuff open.

I have may custom keyboard shortcuts in Vim, that I would like to transfer to ST2.

How can I set up custom shortcuts? Is there an equivalent to vimrc?

I know I can do some chording shortcuts via the OS X Preferences, but they won't respect the command mode in ST2.

For example, I want to set ^w l to move the input focus one column/pane to the right, and ^w h to move to the left.

Best Answer

Custom key bindings: Open Preferences > Key Bindings-Default read through or search for the binding you want to change. Copy the command and then open Preferences > Key Bindings-User. Paste and edit the command.

To change the bindings for switching panes, edit these commands. Notice how keys are separated by + and the end of each line (except the last) needs a comma. I'm not sure if you can set it up so you can move to right/left panes. The way I set it up is ctrl + 1 switches to the first pane, etc.

// panes
{ "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } },
{ "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } }

More info: http://docs.sublimetext.info/en/latest/customization/key_bindings.html

Related Question