Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text - how to figure out internal command name for key binding?

I'd like to bind a shortcut key to Edit > Tag > Wrap Selection with Tag. How do I figure out the command name so I can put that into the user key bindings?

like image 1000
CaptSaltyJack Avatar asked Sep 18 '13 20:09

CaptSaltyJack


People also ask

How do I change key bindings in Sublime Text?

Users can customize their key bindings by creating a file named Default. sublime-keymap in their Packages/User/ directory. For example, the following will create a key binding to show unsaved changes, if any exist, via Ctrl+Shift+`.

What does ctrl d do in Sublime Text?

Ctrl + D in SublimeText is "Quick Add Next." This appears to be equivalent to Ctrl + B in Brackets, which is "Add next match to Selection" on the Find menu.

What is Sublime Text keymap?

Key bindings in Sublime Text helps a user to process and map the sequences of key presses to actions. They are defined in the JSON format and are stored in . sublime-keymap files. For better integration, it is important to keep separate key map files for Linux, OSX and Windows.

What are key bindings?

key binding (plural key bindings) (computing) A key, or key combination, which, when pressed, causes something to happen. I changed the key binding for pause to the Escape key.


1 Answers

Hit Ctrl` (backtick) to open the console, then enter

sublime.log_commands(True) 

to turn on command logging. Go through the menus and click your target, and

command: insert_snippet {"name": "Packages/XML/long-tag.sublime-snippet"} 

comes up. Enter the following into your Preferences -> Key Bindings - User file:

{ "keys": ["ctrl+alt+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } } 

(changing the key combo if you wish) and you should be all set. Once you're done, go back to the console and enter

sublime.log_commands(False) 

to turn off logging of every single action.

like image 87
MattDMo Avatar answered Sep 19 '22 18:09

MattDMo