33 votes

What is the difference between the vim snippets plugins?

I've been using ultisnips for several weeks now. I think the main advantages of this plugin are the following: It is pretty fast even with a great number of snippets available. The basic syntax to ...
statox's user avatar
  • 49.8k
22 votes

What is the difference between the vim snippets plugins?

I've been using the original SnipMate since I started using Vim. It doesn't have external dependencies. It uses a very simple syntax. It is very easy to set up. It has been abandoned since 2009. I ...
romainl's user avatar
  • 40.6k
14 votes

What is the difference between the vim snippets plugins?

SnipMate and UltiSnips are the two most popular snippet engine for Vim. Both are inspired from TextMate's snippet syntax. UltiSnips can run all SnipMate snippets but also have additional syntax to ...
otter.pro's user avatar
  • 498
13 votes

What is the difference between the vim snippets plugins?

Here is a list of features from mu-template. Discl.: I'm its maintainer. Template-files can be expanded: automatically when opening a new buffer (unless deactivated from the .vimrc), explicitly ...
Luc Hermitte's user avatar
  • 17.4k
9 votes
Accepted

UltiSnips: optional line

I think you can get the same result as in the video with this code: ${1/(".*)|.*/(?1:comment => )/}${1:"some comment"}${1/(".*)|.*/(?1:, )/} It can be broken down into 3 parts: ┌ mirror of ...
user786441's user avatar
9 votes
Accepted

How can I use several triggers for the same snippet?

Currently there is no way to do this in UltiSnips. There is an open feature-request on Github for it though. Personally, I would like an alias functionality for triggers as indicated here too. Let's ...
cbaumhardt's user avatar
  • 2,129
7 votes
Accepted

Can this be done with Ultisnips?

Main Ideas There are 3 cases to consider (reworded slightly from the original question): a) If not in an itemize environment, create one, and place the cursor after the first \item. b) If in an ...
husB's user avatar
  • 2,083
6 votes

How can I use several triggers for the same snippet?

Although there is no specific syntax for aliases you can achieve the same effect by using post_jump: # c.snippets global !p def expand(snip): if snip.tabstop != 1: return vim.eval('...
RubenLaguna's user avatar
6 votes

How does Ultisnips select snippet files for the file I'm currently editing?

From :help UltiSnips-adding-snippets (section 4.1): UltiSnips iterates over the snippet definition directories looking for files with names of the following patterns: ft.snippets, ft_*.snippets,...
8bittree's user avatar
  • 1,536
6 votes
Accepted

Some function keys switch cases of letters under and after the cursor

The codes which keys produce varies wildly by terminal. vim tries to guess which escape sequences corresponds to which keycodes (<f1> etc) based on the $TERM variable and terminfo. The shifted ...
Mass's user avatar
  • 14.1k
5 votes
Accepted

Trigger reindentation after snippet has expanded to word in 'indentkeys'

You can manually fix the indent by typing CTRL-F (this is documented at :help indentkeys-format). Thus, an autonomous solution would be to issue this key-press after snippet expansion. global !p def ...
Mass's user avatar
  • 14.1k
5 votes
Accepted

Where do I define UtliSnips snippets for Python?

:UltiSnipsEdit will automatically open ultisnips for current filetype. From there you can see that it's supposed to be python.snippets.
mahbubweb's user avatar
  • 602
5 votes
Accepted

Snippets only working when preceeded by space

You have to use the i option. This is in the help page: i In-word expansion - By default a snippet is expanded only if the tab trigger is the first word on the line or is preceded by one ...
TornaxO7's user avatar
  • 561
5 votes
Accepted

UltiSnips comment variable

Overview Ultisnips supports vimscript interpolation. To illustrate, the todo snippet for a block comment will have following structure: snippet todob "todo with block comment" b `!v {...
husB's user avatar
  • 2,083
5 votes
Accepted

What does ${VISUAL} do in snippets?

From :h UltiSnips-visual-placeholder, Snippets can contain a special placeholder called ${VISUAL}. The ${VISUAL} variable is expanded with the text selected just prior to expanding the snippet. To ...
husB's user avatar
  • 2,083
4 votes

Adding a snippet file locally (for this file only)

If your template expander plugin doesn't support snippets local to the current buffer, i.e. if b:UltiSnipsSnippetDirectories is not understood in your case, you can ask the maintainers to use this ...
Luc Hermitte's user avatar
  • 17.4k
4 votes
Accepted

Vim UltiSnips for python not working

This is because of this line in UtliSnips documentation: UltiSnips comes without snippets. The default snippets can be found here: https://github.com/honza/vim-snippets UltiSnips is just an engine,...
grodzik's user avatar
  • 4,588
4 votes
Accepted

custom snippet extender Ultisnips

Use remap to trigger expansion imap "prg prg<c-a> or exe printf('imap "prg prg%s', g:UltiSnipsExpandTrigger) But not this: imap <expr> "prg 'prg' . g:UltiSnipsExpandTrigger g:...
dedowsdi's user avatar
  • 6,248
4 votes

How to change the docstring format of the snippets by Ultisnips?

Change the entire format to Google's... It's not documented, but the Python snippets file from vim-snippets does allow you to specify docstring style. Simply add let g:ultisnips_python_style = '...
ZeroKnight's user avatar
  • 1,081
4 votes

Ultisnips: autocompletion of (). Make snippet not expand again

I got it to work: global !p def mycontext(char): x = vim.current.window.buffer y = vim.current.window.cursor[0] z = vim.current.window.cursor[1] try: ...
jfab's user avatar
  • 41
3 votes
Accepted

LaTeX: Ultisnips

Neocomplete is an alternative that may have different snippets and is compatible with the UltiSnips repository. Other than that if you can't find what you are looking for, you might have to create ...
LEI's user avatar
  • 1,626
3 votes
Accepted

Why can't UltiSnips use python while 'python' is enabled?

The problem comes from the fact that your Vim setup supports python, but python is not installed on your system. When Vim has the 'python' and/or 'python3' features enabled that means that it ...
statox's user avatar
  • 49.8k
3 votes
Accepted

Add current directory to UltiSnips search directory

First of all :h UltiSnips-snippet-search-path tells us: Snippet definition files are stored in snippet directories. A snippet directory must be a subdirectory of a directory defined in the '...
statox's user avatar
  • 49.8k
3 votes
Accepted

UltiSnips, Context and Tex

UPDATED UPDATE I noticed that checking simply for texMathZone... at the beginning or end of the synstack is not sufficient. Every element has to be checked. As the OP has requested there should be a ...
Hotschke's user avatar
  • 4,750
3 votes
Accepted

Stop Snippet from Triggering Inside Other Snippet

I add my comment as answer with the complete snippet file. Negative Lookbehind Assertion in Python Regular Expressions Python documentation: https://docs.python.org/3/library/re.html#index-23 (?<...
Hotschke's user avatar
  • 4,750
3 votes
Accepted

Ultisnips - Create a placeholder/tabstop inside a python interpolation?

Thanks to husB for point me the dynamic tabstop generation, i don't know why it isn't in the doc. The final snippet: global !p def create_line_plhldr(snip): num = int(snip.buffer[snip.line]....
Bepitic's user avatar
  • 61
3 votes
Accepted

Ultisnips py3 errors

The error you are getting is happening because your Vim doesn't include support for Python, which is required by UltiSnips, as that plug-in is implemented in Python for the most part. My ...
filbranden's user avatar
  • 28.8k
3 votes

Where do I define UtliSnips snippets for Python?

UltiSnips uses a strategy similar to how Vim detects :h ftplugins. That is, it will look for the filenames that match the following pattern in your UltiSnips directory: ft.snippets, ft_*.snippets, or ...
Jake Grossman's user avatar
3 votes
Accepted

Contextual Snippets in UltiSnips not working

The problem is that you have updated your plugins in the transition Linux to Mac. This also brings a major update of Vimtex, in which the syntax plugin has been included as part of Vimtex. Part of the ...
Karl Yngve Lervåg's user avatar
3 votes

Undo-joining a mapping that uses the expression register

Besides UltiSnips#ExpandSnippet(), there is also UltiSnips#Anon(). The latter expands a snippet that is defined on-the-fly. Importantly, unlike UltiSnips#ExpandSnippet(), UltiSnips#Anon() does not ...
husB's user avatar
  • 2,083

Only top scored, non community-wiki answers of a minimum length are eligible