I’m trying to switch to Atom from years of Sublime Text 2/3. In Sublime, I had a shortcut for SCSS grammar — “+ tab” that added a certain snippet. I managed to set up it the same in Atom, however, in an ugly way, by changing both the keymap and the init script.
So my question is, is there a way to add a snippet directly into the keymap? Or, even more preferably, to call a snippet from
snippets.cson by its prefix for current grammar.
Right now, first, I add a new command to īnsert the snippet in
atom.commands.add 'atom-text-editor', 'editor:insert-include-snippet', -> snippetBody = "@include $1;$0" atom.packages.activePackages.snippets?.mainModule?.insert snippetBody
And I have it added to my keymap:
'atom-text-editor[data-grammar="source css scss"]': '+ tab': 'editor:insert-include-snippet'
But I feel like this is way more code than should be necessary (specifically in the init script).