Skip to content

Instantly share code, notes, and snippets.

@shmcgrath
shmcgrath / markdown.snippets
Created April 23, 2019 01:38
How to use UltiSnips to Pull in Multiple Python String Templates via the VISUAL Selection
# To use this functionality, [UltiSnips](https://github.com/sirver/UltiSnips) and Vim are needed.
# get_templates is called from tempit. What this does is it takes the Visual text (what was highlighted)
# and parses it on spaces. It then takes those "trigger" words and calls the function with that name.
# so tema calls tema(). I then set up snippets with the same trigger words calling those functions.
# To order the templates, you basically put them in the order that you want them to appear.
# typing "tema temc temd" in Vim, highlighting it, then hitting "tab" typing "tempit" "tab" will make
# "tema temc temd" the string that is passed to get_templates. get_templates then spits out the python
# strings (the templates) in the order that they are passed. This means to order the templates, just
# type out the function names / triggers in the order you want them.
# By calling the functions from identically named snippets, it gives flexibility to call them in the initial