Questions tagged [ultisnips]

UltiSnips is a TextMate-inspired SnipMate-compatible snippet system for Vim.

UltiSnips is a TextMate-inspired SnipMate-compatible snippet system for Vim. It includes shell, VimScript and Python interpolation, and trigger matching based on regular expressions.

96 questions
0
votes
1 answer

Vim Snippets (Ultisnips): is there a snippet for simple ( and {?

Before I try to write my own, I'm wondering if there is a simple snippet for { and (? For example If I'm writing this (my cursor is the |): abc abc (| and then press tab, I want this: abc abc ( | ) The exact same with { }....
pixelearth
  • 13,674
  • 10
  • 62
  • 110
0
votes
1 answer

Use spaces in UltiSnips snippets

I can't seem to use spaces in snippets at all. Ultisnips throws errors on the following: snippet 'dv(?=[ \n])' "derivative" rA 2 \dv{$1}{$2}$0 endsnippet My goal is to expand the snippet automatically if and only if dv precedes a space or newline,…
0
votes
1 answer

ultisnip completion within active snippet

I have the following snippet: snippet ta "table" b .${1:Title} [${2:width="${3:80%}",cols="${4:}",frame="topbot",options="header",stripe="even"}] |==== |$0 …
Boyd
  • 351
  • 4
  • 14
0
votes
1 answer

Ultisnips: option to disable some snips with a single ex command?

I'm writing Latex, and recently found some of the following snippets: snippet // "Fraction" iA \\frac{$1}{$2}$0 endsnippet snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "Fraction" wrA \\frac{`!p snip.rv =…
herophant
  • 642
  • 7
  • 16
0
votes
1 answer

UltiSnips: How to make placeholder optional

I have to create something that looks like this: \begin{frame}[fragile]{frame title} lorem ipsum ... \end{frame} Note that the portion [fragile] is optional. That is, if I enter some text in the $1 placeholder, it should include the brackets. If…
jlconlin
  • 14,206
  • 22
  • 72
  • 105
0
votes
1 answer

How to make Ultisnips (vim) only trigger after a `>` character?

I want to make a snippet which only triggers after a > symbol, that way if I'm inside a (x), and I hit tab it won't trigger, but if it's after an html tag like
x it will trigger.
Tallboy
  • 12,847
  • 13
  • 82
  • 173
0
votes
1 answer

ViM provides a list of alternative snippets, but I'm not able to select any of them

I can navigate up and down in the list, but if I press Enter when one of them is selected, it just inserts that value, e.g. html5 and exists from the dropdown. How can I select one and have the snippet triggered? This is my snippet config: …
martins
  • 9,669
  • 11
  • 57
  • 85
0
votes
0 answers

Make ultisnips snippet save the file in vim

I would like to define a ultisnips snippet which would enter some text and then save the file. I checked the help and think most likely the vimscript execution would be the way to go. I've tried to search how to do that, here's what I tried: snippet…
sygi
  • 4,557
  • 2
  • 32
  • 54
0
votes
1 answer

Vim UltiSnips for python not working

Maybe it's a stupid question, but I can't figure it out. I have installed the UltiSnips plugin [UltiSnips plugin][1]. I followed all the instructions on setting it up. I added this into my .vimrc file but it's not working: " Track the engine. Plugin…
Nurjan
  • 5,889
  • 5
  • 34
  • 54
0
votes
1 answer

utltsnips - surround with space

I have the following utilsnips script that I use for Vim: snippet - "assignment" <- endsnippet I use it for R to expand a dash to the assignment operator. I would like to make it so that a space is put both before and after the <- on expansion.…
paljenczy
  • 4,779
  • 8
  • 33
  • 46
0
votes
1 answer

Add tabstop in python expression in UltiSnip

I made a modification of the example given by UltiSnip doc: snippet "be(gin)?( (\S+))?" "begin{} / end{}" br \begin{${1:`!p snip.rv = match.group(3) if match.group(2) is not None else "something"`}}${2:`!p if match.group(2) is not None and…
van abel
  • 181
  • 10
0
votes
1 answer

How exactly is this regex working in UltiSnips for Vim?

I just started using UltiSnips for Vim and now I'm trying out transformations. I can't wrap my head around one of the first examples given in the screencast. The transformation is for an HTML tag to drop everything but the tag name for the closing…
kiriappeee
  • 87
  • 7
0
votes
0 answers

How to map two actions to a single key in select mode (UltiSnips and neosnippet Integration)

I am trying to use UltiSnips and neosnippet plugins simultaneously because of some features that the one has and the other doesn'nt and vice versa. So Mapped Ultisnips and neosnippet like the following : "UltiSnips let…
dNitro
  • 5,145
  • 2
  • 20
  • 45
0
votes
1 answer

vim ultisnip expanding after the line break

I use Ultisnips in vim a lot together with vim-expand: snippet prg !This is file : `!v expand('%:r')` ! Author= `!v expand($USER)` ! Started at: `date +%d.%m.%y` ! Program ${1:`!v expand('%:r')`} Implicit None ${2:<++Start Typing++>} End Program …
BaRud
  • 3,055
  • 7
  • 41
  • 89
0
votes
1 answer

vim and Ultisnips

I'm trying to understand how Ultisnips works (very few documentation when you're a beginner like me) and in the all.snippets code there a function that returns vim.eval("&comments") So I'm trying to guess how this works, and if I try: :let…
Olivier Pons
  • 15,363
  • 26
  • 117
  • 213