Programs » Sublime Text

Custom Shortcuts

Create a custom shortcut

1. Go to Preferences -> Key Bindings – User

2. Add a row with the following format:

{"keys": [(key)], "command": (command)},

or

{"keys": [(key)], "command": (command), "args": {(arg_key): (arg_value)}},

where

(key) - a shortcut ("ctrl+u"),
(command) - a Sublime Text command ("toggle_side_bar"),
(arg_key) - argument key,
(arg_value) - argument value

3. Save the file.

4. Check the shortcut.

Commands for Shortcuts

Some useful commands to add shortcut to (with my shortcuts).
List of commands can be found in the Packages\Default folder in these files:

Main.sublime-menu
Default.sublime-commands

The files exist only in the Sublime Text 2 Packages folder.

1. File -> Save

{ "keys": ["f1"], "command": "save" },

2. File -> Save All

{"keys": ["ctrl+shift+s"], "command": "save_all"},

3. File -> Close

{ "keys": ["f4"], "command": "close" },

4. File -> Close All

{"keys": ["ctrl+shift+w"], "command": "close_all"},

 

5. Edit -> Line -> Delete Line

{"keys": ["ctrl+e"], "command": "run_macro_file","args": {"file": "Packages/Default/Delete Line.sublime-macro"}},

6. Edit -> Line -> Duplicate Line and a command from the Duplicate Lines plugin

{"keys": ["ctrl+shift+d"], "command": "duplicate_line"},
{"keys": ["ctrl+d"], "command": "duplicate_lines"},

7. Edit -> Comment -> Toggle Comment/Toggle Block Comment

{"keys": ["ctrl+1"], "command": "toggle_comment", "args": {"block": false}},
{"keys": ["ctrl+shift+1"], "command": "toggle_comment", "args": {"block": true}},

8. Edit -> Convert Case -> Title Case

{"keys": ["ctrl+t"], "command": "title_case"},

9. Edit -> Undo selection -> Soft Undo (undoes adding to multiple selection)

{ "keys": ["ctrl+shift+u"], "command": "soft_undo" },

 

10. Selection -> Expand Selection to Brackets

{"keys": ["ctrl+alt+shift+m"], "command": "expand_selection", "args": {"to": "brackets"}},

11. Selection -> Expand Selection to Word (adds next found word to multiple selection)

{"keys": ["ctrl+q"], "command": "find_under_expand"},

12. Find -> Find Previous

{"keys": ["f2"], "command": "find_prev"},

 

13. View -> Word Wrap

{"keys": ["ctrl+u"], "command": "toggle_setting", "args": {"setting": "word_wrap"}},

14. View -> Side Bar -> Show/Hide Side Bar  

{"keys": ["ctrl+b"], "command": "toggle_side_bar"},

15. View -> Show/Hide Minimap

{"keys": ["ctrl+shift+m"], "command": "toggle_minimap"},

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>