The capture_snippet
command is fairly simple: it grabs the current selection (or the concatentation of all your selections [joined by newlines]) and stuffs it in a .sublime-snippet file. It takes a few measures to ensure the snippet has sane indentation, but otherwise it's as dumb as it sounds, and surprisingly useful in spite of that.
capture_snippet takes only one possible argument: name
, which is a path relative to the Packages/ directory of your Sublime Text installation's user directory. By default, it uses "User/captured-snippet.sublime-snippet"
.
To use the snippet, just set up a key-binding to insert it.
This gist should contain example keybindings that show the command's usage and an example keybinding for the insert_snippet command.
capture_snippet is public domain because who cares as long as someone finds it useful.