Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a keyboard shortcut for creating a snippet in Sublime Text?

Going to Tools > New Snippet everytime I need to create a new Sublime Snippet is starting to become cumbersome. Is there a way to create a shortcut in which I can jump to the new snippet page by pressing Command + i?

like image 244
10000RubyPools Avatar asked Dec 06 '25 02:12

10000RubyPools


1 Answers

Preferences -> Key Bindings - User, then add the below line:

{ "keys": ["ctrl+g"], "command": "new_snippet" }

You can replace the ctrl+g combination with anything of course.

BUT be aware: it might happen that the keyboard layout doesn't send the exact keys that the command is bound to. To investigate this open the console at View -> Show Console or with CTRL+, and type sublime.log_input(True). Now click in the document and give your key combination a try - if the appropriate output doesn't appear in the console, you better specify another combination.

Finally, if sublime.log_input(True) bothers your coding or debugging process, you can easily disable it by clicking again in the console and using the UP arrow to get the command you typed the last type, change True to False, then hit Enter.

like image 55
Edward Munch Avatar answered Dec 08 '25 16:12

Edward Munch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!