Overriding and maintaining key bindings
In the previous chapter, we bound as key combination to our macro. Sublime also gives us the option to bind keys to any command by adding custom key bindings; but what are key bindings exactly? In one sentence:
"Key bindings map key presses to commands."
All of Sublime's key bindings are configurable by JSON-formatted .sublime-keymap
files.
Platform-specific key bindings
Key bindings can be different per platform; their filename has to be one of the following:
Default (Windows).sublime-keymap
Default (OSX).sublime-keymap
Default (Linux).sublime-keymap
These file names are platform dependent; this means that the key bindings defined in the Windows keymap
file will only work if we are on Windows or other OSes. It is important to know that user-specified key bindings need to be placed in Packages/User/Default (<platform>).sublime-keymap
.
Key map file structure
A key map is an array of key bindings. Each key binding contains the following elements:
keys...