Assuming I have a snippet called “My Snippet.sublime-snippet”, what’s the syntax in the keymap file to call this snippet?
How to create a key binding to call a snippet by name?
agibsonsw
#3
{ "keys": "alt+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/User/My Snippet.sublime-snippet" } }
I prefer to remove the space (personally).
0 Likes
handycam
#5
OK, it doesn’t work for me, I’m sure it’s something stupid.
Key command:
{ "keys": "shift-ctrl-b"], "command": "insert_snippet", "args": { "name": "Packages/User/Strong.sublime-snippet" } }
Snippet:
<snippet>
<content><![CDATA[
<strong>$SELECTION</strong>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
0 Likes
agibsonsw
#6
ctrl+shift+b
As mentioned by COD312, you should examine the default key-bindings to guide you.
0 Likes
handycam
#7
[quote=“agibsonsw”]ctrl+shift+b
As mentioned by COD312, you should examine the default key-bindings to guide you.[/quote]
Damn. What a jerk I am. Thanks.
0 Likes