This is a noob question. I just installed UltiSnip to make use of the TeX snippets. Here is the relevant part of my init.vim:

" Specify a directory for plugins (powered by vim-plug)
call plug#begin('~/.vim/plugged')

" Make sure you use single quotes
 Plug 'lambdalisue/suda.vim'
 Plug 'powerman/vim-plugin-ruscmd'
 Plug 'tpope/vim-fugitive'
 Plug 'lervag/vimtex'
 Plug 'SirVer/ultisnips'
 Plug 'honza/vim-snippets'
 Plug 'dart-lang/dart-vim-plugin'
 Plug 'natebosch/vim-lsc'

" Initialize plugin system
call plug#end()

" UltiSnips group
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

The edited file extension is tex. I presume that it's enough to write table in edit mode and push . It's just a tab entered. My research shows that 'not working' is a quite common problem, but no reasonable way of troubleshooting is suggested, just obscure bits and loose ends. I tried let g:UltiSnipsSnippetDirectories=["UltiSnips"] and let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/plugged/vim-snippets/UltiSnips'], to no avail. :UltiSnipsAddFiletypes manually, the same. The docs are big on features, but way too concise on getting started.

.vim directory is shared via symlink, no trouble so far:

$ ln -s /home/user/.vim /home/user/.local/share/nvim/site

Any ideas?


Oh, sorry. It turned out that with

let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/plugged/vim-snippets/UltiSnips']

and after manual intervention

:UltiSnipsAddFiletypes tex

it starts breathing. What am I still missing?

  • This is a known issue. Of extensions, it honors only *.latex. Fortunately, if the file contains a preamble (\documentclass{} will do), it is honored on loading. – Alexey Orlov Mar 27 '19 at 20:55
  • sounds like you can self-answer then? – D. Ben Knoble Mar 28 '19 at 1:09
  • Well, almost so. The known issue mentions also a workaround of sorts, which I cannot fathom, as a noob :) – Alexey Orlov Mar 28 '19 at 4:29
  • I do not know exactly what your problem is. As you have added the neovim tag I assume it does not work for neovim and you are re-using your old vim configuration since you use at two positions ~/.vim paths. Why is then ~/.vim a symlink to neovim? I would guess it should be the other way around. neovim stores its init.vim in ~/.config/neovim/init.vim. I have added let g:tex_flavor='latex' to my vimrc so that an empty .tex is treated as a latex file and not as a plaintex file. This also affects which snippets are available. – Hotschke Mar 28 '19 at 6:46
  • I'd recommend that you simplify your configuration in a first step by using a fresh configuration for neovim. If it works you can try symlinking things to have the same config for neovim & vim. – Hotschke Mar 28 '19 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.