Using UltiSnips, I'd like to add a set of snippets just for one file or for a set of files in the same directory, maybe using a :vim modeline.
I tried to put
let g:UltiSnipsSnippetDirectories=["UltiSnips", "."]
in my .vimrc and then adding a all.snippets file in the same directory of the file (by the way, it is a LaTeX file — I tried also with tex_local.snippets file) but it doesn't work.
The rational is the following: I am writing a beamer presentation and I have a repeating pattern for several frames --- one that is two diagrams side by side for example, another a figure and a plot, and so on.
So I have defined snippets that create the 3 or 4 patterns I like for this presentation, and happily added them to my .vimtex/UltiSnips/tex_local.snippets file --- and all is fine. But these snippets are really only useful for this file, and at the end of the day I do not want to keep adding very local things to the generic snippets definitions...
sourceit in your vimrc. The "per-file" autocmd events could be in vimrc or in that file. Otherwise, feel free to add that functionality ;) – VanLaser Feb 04 '16 at 15:21g:UltiSnipsSnippetDirectoriesis used in the sources (grep g:UltiSnipsSnippetDirectories **/*gives just the place where it is defined or supplied as default...) – Rmano Feb 04 '16 at 16:12http://vi.stackexchange.com/questions/4185/how-do-i-change-directory-for-ultisnips-snippets
Namely, it is enough to add
set rtp+=.
to a local .vimrc. I hope this helps.
– Niels Apr 10 '17 at 20:40