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
2
votes
1 answer

How to expand current filename without 'test' in vimscript or UltiSnips

I'm writing a snippet in which I need to get the current file name in vimscript. I can do this happily with expand('%:t:r') (as shown here). However, I'd like to not only exclude '.js' from the filename, but also '.test'. e.g. If in myName.test.js,…
James Mulholland
  • 1,782
  • 1
  • 14
  • 21
2
votes
2 answers

Ultisnips python interpolation snippet, extracting number from filename

I am trying to make a snippet that will help me choose the right revision number for migration, by reading all migration files from application/migrations. What I managed to do myself is that my filenames are being filtered while I am typing, and…
branquito
  • 3,864
  • 5
  • 35
  • 60
2
votes
1 answer

Write a snippet that removes the initial variable at the end, leaving only the modified ones

Let's say I have an UltiSnips snippet that shall replace all special characters with an underscore. I have this: snippet us "replace specials with underscores" w ${1:${VISUAL}} `!p import re snip.rv = re.sub("[^0-9a-zA-Z]", "_",…
Xiphias
  • 4,468
  • 4
  • 28
  • 51
2
votes
5 answers

Why UltiSnips does not recognize my own snippets?

Currently I use YouCompleteMe in Vim, then I have installed UltiSnips and vim-snippets with vundler. UltiSnips and YouCompleteMe are compatible and work properly; however, the problem comes when I define my own snippet because these are not…
Erick Chacon
  • 893
  • 8
  • 15
2
votes
1 answer

vim script search function without polluting change list (undo)

So I wrote a small ulti-snips snippet with python interpolation. usually when you hit undo, after expanding the snippet, it goes back to trigger word. But in this case I have to hit the undo twice. I suspect it's the search function I am using. I…
linusx
  • 306
  • 2
  • 10
2
votes
4 answers

Generate getters and setters using UltiSnip in Vim

I want to create an UltiSnip code in which is similar to the one used in their Github README. I understand it involves python interpolation and I am finding it difficult to write my own interpretation. Their documenation gives a good list what…
2
votes
2 answers

How Ultisnips transforms text instantly in Vim?

SirVer/ultisnips is a very productive plugin for writing scripts in Vim. But anyone knows How Ultisnips transforms text instantly in Vim as shown in the gif. Ultisnips in this example is transforming every character in text "This is the subtitle"…
Life
  • 449
  • 3
  • 9
2
votes
1 answer

Vim UltiSnips '' doesn't work and return "?" mark

these are lines in my .vimrc to map UltiSnips plugin: let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" Ctrl+j it's work well to expand trigger and jump forward, but when press…
GsHs
  • 21
  • 2
2
votes
2 answers

Generating a specified number of sub-snippets using Ultisnips in vim

I currently have a tex.snippets file to hold snippets which make writing homework in LaTeX easier. For example, I have a snippet '2problem' of the form: snippet 2problem \begin{homeworkProblem} \begin{enumerate} \item[] $1 …
Leeren
  • 1,931
  • 2
  • 20
  • 31
2
votes
1 answer

How does VIM's Ultisnips plugin handle delete inside of HTML snips? How do I change id to class in a div?

I'm new to Ultisnips. In insert mode I type div [tab] then I get:
With the cursor on name. If i wan't to use class instead of id I hit backspace and get this
With the cursor on the first v. Now if I want to…
jeff_kile
  • 1,805
  • 16
  • 21
1
vote
1 answer

how can i make a code snippet in vscode / Ultisnips(vim) that can have variable number of arguments (tab triggers) like this:

if i type input5, then it produces code like: cin >> $1 >> $2 >> $3 >> $4 >> $5;$0 and if i type input2, then it produces code like: cin >> $1 >> $2;$0 Another example: if i type arrinputmn (where m and n is the size of mxn matrix), then it produces…
1
vote
2 answers

UltiSnips shell/python interpolation and ${VISUAL}

I really can not figure how to do this. I am trying to create a snippet that will read a file (the name I will get it by selecting it so it will be in the ${VISUAL}) and then using grep extract a line from it. What I tried is something like !v cat…
Samar
  • 21
  • 3
1
vote
1 answer

E492: UltiSnips not an editor command

When I'm trying to use UltiSnips, it returns this error: E492: Not an editor command: snippet test "Test Snippet" E492: Not an editor command: Test E492: Not an editor command: endsnippet My .vimrc look like that: https://pastebin.com/0AwFks2J What…
FEgor
  • 13
  • 4
1
vote
1 answer

vim ultisnips adds a delay when left-shifting in visual mode

I recently installed the ultisnips plugin on neovim, and I'm having an issue with it: When I enable ultisnips, when I press < in visual mode, there's a delay until my lines are left-shifted, but my right-shifting using > works instantly. If I run…
Farzad
  • 1,770
  • 4
  • 26
  • 48
1
vote
1 answer

Vim with Ultisnips and bracket-matching (auto-pairs) mapped to the same key

I use vim mainly for latex. The main reason why I do it is actually Ultisnips, which greatly reduces the number of symbols that I need to type in latex. Alongside it, I use auto-pairs, which matches brackets for me. One small gripe that I have with…
ge0rg
  • 63
  • 1
  • 11