We’re rewarding the question askers & reputations are being recalculated! Read more.
22

I've been using ultisnips for several weeks now: I think the main advantages of this plugins are the following: It is pretty fast even with a great number of snippets available. The basic syntax to define a new snippet is easy to understand, thus it is easy to create quickly a new snippet doing what you want to do. (For more complex snippets some ...


12

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 have nothing to complain about.


8

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 hope SirVer (the maintainer of UltiSnips) will think so too and include it in the future :)


7

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 through menus or the command line, from the INSERT-mode in a snippet-like fashion ; from the VISUAL-mode to surround the selection with a snippet -- the surrounding ...


5

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 tabstop n°1 │ ┌ substitution ┌─┤┌─────────────────────────┤ (A) ${1/(".*)|.*/(?1:comment => )/} ┌ tabstop n° 1 ...


4

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('feedkeys("\<C-R>=UltiSnips#ExpandSnippet()\<CR>")') endglobal snippet incstdlib "#include <stdlib.h>" !b #include <stdlib.h> /* exit(), ...


4

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 make it more powerful. A good rule of thumb is that if your Vim has python support, then use UltiSnips. If not, then use SnipMate. In my .vimrc, I load (using ...


4

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 variable if defined, or the global one otherwise -- this is the best course of action or you can use another snippet engine that supports local snippets or you ...


4

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:UltiSnipsExpandTrigger is a variable, map won't figure out special key code of it's value for you. Manual expansion inoremap "prg prg<c-r>=UltiSnips#...


3

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, or ft/*, where "ft" is the 'filetype' of the current document and "*" is a shell-like wildcard matching any string including the empty string. The ...


3

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 provides an interface to interact with python code: you can make Vim to ask the system to execute a python statement or a whole python code. Even if the interface is ...


3

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 'runtimepath' option. Which makes me think that you can not create snippets directories anywhere since that would mean constantly add your current path to ...


3

You want to use UltiSnipsAddFiletypes. As the docs say: The UltiSnipsAddFiletypes command allows for explicit merging of other snippet filetypes for the current buffer. For example, if you edit a .rst file but also want the Lua snippets to be available you can issue the command > :UltiSnipsAddFiletypes rst.lua To automatically set the filetype ...


3

It's difficult to point out where your problem is, since you didn't really describe what exactly you did; but this is how I added a custom PHP snippet file: I installed http://github.com/SirVer/ultisnips and http://github.com/honza/vim-snippets I created ~/.vim/UltiSnips/php.snippets with the contents: extends php, html snippet 42 The universe, life, and ...


3

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 f-keys are not standardized and they do not have termcap/terminfo entries. In this case, vim falls back to the xterm ones. Note, wherever ^[ is written, this ...


2

Apparently Ultisnips only does this for tab as early adopters of the plugin complained that it broke supertab. It's worth asking the maintainer whether he'd be willing to fix this for <CR> too. That being said, there is a workaround that's described in the docs: let g:ulti_expand_or_jump_res = 0 "default value, just set once function! ...


2

UltiSnips has the extends keyword. You pass a comma separated list of filetypes to it and it will load the snippets for those filetypes before the snippets in the file the keyword is used in. Example: extends c, obj-c This way you can have a "cpp.snippets" file which "extends" your c filetype and obj-c type. The documentation doesn't mention cyclic ...


2

Unfortunately <c-i> and <tab> are parsed as the exact same key by most terminals. You can follow a discussion about this on this neovim issue: https://github.com/neovim/neovim/issues/176 The easiest solution is to pick a different mapping for jumping backwards, like <leader>i. If you really want this fixed, I suggest following the linked ...


2

I don't think you have to do that for Pathogen + UltiSnips + vim-snippets. I have such setup and only thing in my vimrc is let g:UltiSnipsExpandTrigger="<c-j>". Both plugins are in ~/.vim/bundle.


2

From documentation on :nnoremap: :no[remap]! {lhs} {rhs} […] Disallow mapping of {rhs}, to avoid nested and recursive mappings. But the whole point of your mapping is to use recursive mapping of Tab! Use :nmap instead. Alternatively, and even preferably, use the following: nnoremap KEYCOMBO iULTISNIPTRIGGER <esc>:call UltiSnips#ExpandSnippet(...


2

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 fix_indent(snip): vim.eval('feedkeys("\<c-f>")') endglobal post_expand "fix_indent(snip)" snippet it "Individual item" b \item $0 endsnippet


2

g:UltiSnipsSnippetDirectories are used to search snippets, it's default to ['UltiSnips'], there are 2 kinds of settings: relative path let g:UltiSnipsSnippetDirectories = ['UltiSnips','foo'] UltiSips will loop each path in runtimepath to search for child directory named UltiSnips and foo, and use them as snippets source. Note that "snippets" is reserved ...


2

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 (?<!...) Important limitation: Similar to positive lookbehind assertions, the contained pattern must only match strings of some fixed length. Patterns which ...


1

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, you need to install/create own snippets. I use those recommended vim-snippets and they work like a charm.


1

Just remove let g:spacevim_custom_plugins=[ \ ['SirVer/ultisnips/', {'on_ft' : 'autocomplete'}], \ ] no need to use custom plugin, just change g:spacevim_snippet_engine is enough. If you still get issue, please use the issue tracker of SpaceVim github repo.


1

So after all the Problem is, that UltiSnips does not search the projectfolder for snippets. If you read :h UltiSnips-snippet-search-path you can see, that it looks for all folders defined in g:UltiSnipsSnippetDirectories which are subfolders of a directory defined in the runtimepath option. :h runtimepath shows that this depending on the OS but mostly ...


1

Have you tried to debug your vimrc file? If the issue is narrowed down to this plugin, the plugin-ultisnips tag would be relevant. Otherwise, you should post the problematic part of your configuration here. Edit: what does :nmap ve output?


1

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 your own as statox stated.


1

In my case I have found in plugged/vim-snippets/UltiSnips/all.snippets a snippet called box that makes something like that: ---------------------- - some text inside - ---------------------- After reading a little bit more the code I figured out that if you set your filetype like :setf c and type box<tab>you will get your something like: /*********...


1

UltiSnipsAddFiletypes is not creating any files. It just informs UltiSnips that when you edit for example a rails file, you also want snippets from file type html and/or ruby and/or javascript and so on. If you run command :UltiSnipsAddFiletypes rails.ruby.html.javascript then it's important what file type is first (rails in this example) - this will be ...


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