Sublime Forum

Defining a shortcut which inserts some characters for a particular file type?


There is a syntax specific settings file which allows me to set various options for a particular file type.

I would like to add an option to this file which is something like a macro: if I press a certain combination of keys, or perhaps select the appropriate command from the command palette, it will paste a certain sequence of characters and place the the cursor after a particular character in the pasted sequence.

For example, maybe I would like to set ALT+F to insert the character sequence \f{} at the current position of my cursor, and once this sequence is inserted, my cursor would be placed in between the parentheses.

I think that for my actual use case (LaTeX), I should set up an auto-completion file completes certain commands for me, rather than doing the above. However, out of curiosity, I am wondering if it is possible to do something like what I have described.



I don’t think there are syntax specific keybindings, but you could use snippets instead.

1 Like


There are syntax specific key bindings by using a context and the selector key.