Setting up Sublime Text 2 Custom Keyboard Shortcuts

13

4

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.

Ben Humphreys

Posted 2012-10-24T08:43:58.853

Reputation: 253

Answers

21

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

d_rail

Posted 2012-10-24T08:43:58.853

Reputation: 2 809

1

To add to @d_rail's answer,

You can create a simple (ex:f12), combination (ex: ctrl+Y) and complex (ex: ctrl+a, ctrl+b) shortcut keys as long as you know the command name of the operation.

See here to know more: Complete list of Sublime Text 3 commands

Narendran Parivallal

Posted 2012-10-24T08:43:58.853

Reputation: 111