Wednesday, September 26, 2012

SublimeText2 - A small tip

It can be difficult to find the correct internal name of a command when you want to add a keyboard shortcut to it in SublimeText2. Wouldn't it be neat if you could show all the commands you trigger in a window somewhere? Well, it turns out it is really simple:
  • Open the console
  • Type the command
    • sublime.log_commands(True)
  • Go do stuff in the editor or menus and see commands roll by. 
When you have the command name it is quite easy to add that to your personalized key-bindings from the Preferences menu.

i.e. my current personalizations:
[
   { "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
   { "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": false } },
   { "keys": ["ctrl+d"], "command": "reindent" },
   { "keys": ["shift+ctrl+s"], "command": "save_all" },
   { "keys": ["ctrl+d"], "command": "find_under_expand" }
]


No comments:

Post a Comment