Ruby Snippets for Sublime Text
You can map keys to insert a specific snippet. This makes especially sense for snippets that can be wrapped around the current selection. A good example would be wrapping the selection in a Begin / Rescue statement. To do so when ALT+SHIFT+R is pressed, add this to your keymap file:
{
"keys" : ["alt+shift+r"],
"command" : "insert_snippet",
"args": {
"name": "Packages/ProductiveSnippetsRuby/begin.sublime-snippet"
}
}
All snippets that can be wraped arround the selection have a [X] in their description. This allows you to define a key mapping, that shows all snippets that you can wrap arround the current selection:
{
"keys": ["alt+shift+w"],
"command": "show_overlay",
"args": {
"overlay": "command_palette",
"text": "Snippet: [X]"
}
}
MIT