UltiSnips – Snippet Solution for Vim
github.com
github.com
That said, it was vscode experience. Pretty sure I can easily create a couple of vim macros for [un]jsoning lines, so maybe it’s worth comparing vs snipmate.
As a heavy vim user for years, I've found myself getting more value out of snippets as of late.
# section #<Esc>yyP:s/./#/g<CR>yyjpo
Instead of the more convenient: box<CTRL-X><CTRL-J>section<CTRL-J>
And to insert the current date and time in ISO 8601 format, type this: <Esc>:Man strftime<CR><CTRL-F><Repeat last key 7 times to scroll through the man page>:q<CR>gi=strftime("%Y-%m-%dT%H:%M:%S%z")<CR>
Instead of this: iso8601<CTRL-X><CTRL-J>
To complete long snippets of text, type this: <Esc>:r path/to/snippet.txt<CR>kJ/<placeholder><CR>cgn<replacement text 1><Esc>cgn<replacement text 2><Esc>cgn
Instead of this: snippet<CTRL-X><CTRL-J><replacement text><CTRL-J><replacement text 1><CTRL-J><replacement text 2><CTRL-J>
The last one might not sound so bad until you realize that you can't have dynamic content in snippets, can't go back to previous placeholders without undoing every change made along the way, can't treat two different placeholders as being equivalent, and most importantly, can't reuse countless useful snippets made by the community.Support for plugins is a first class feature of Vim. While I agree that being aware of the built-in features is a good thing, there's no shame in using plugins that extend Vim in a useful way.
<Esc>:Man strftime<CR><CTRL-F><Repeat last key 7 times to scroll through the man page>:q<CR>gi=strftime("%Y-%m-%dT%H:%M:%S%z")<CR>
was supposed to be this: <Esc>:Man strftime<CR><CTRL-F><Repeat last key 7 times to scroll through the man page>:q<CR>gi<CTRL-R>=strftime("%Y-%m-%dT%H:%M:%S%z")<CR>GP was clearly gatekeeping, but by asking sincerely I hoped to learn something new. And so I have!
All the best.
Also I dislike the fact that you have to actively prevent these expansions instead of actively triggering them.
Like, I prefer to have my own snippets and set them up the way I want, but hey - the convenience of LLMs... idk
For example, if I want to add an image to a document, the necessary full command to type this might be `\includegraphics[scale=0.5]{Image_file_name}`, which is a lot to type for image-heavy documents.
But with UltiSnips, I can write any shortcut (e.g. by typing `img` and pressing the `Tab` key or alternatively letting it auto-complete depending on my snippet setting), then the whole command is typed out: `\includegraphics[scale=0.5]{$1}$0`. My cursor would immediately be placed at the $1 position, and pressing the `Tab` key would take me outside to the $0 position, so I can keep typing.
It's simple and predictable for myself as a user to easily write the full command, whereas I predict that a solution that uses an large language model (LLM) for this context may add complexity without making the task easier for my purposes (though LLM-based software may be more useful in other contexts).
Also, why wouldn't you just use both? Snippets let you quickly use known patterns, LLMs let you quickly write the more generic case of boilerplate that doesn't align well with snippet use.