Open giddie opened 4 years ago
I've found a workaround for this that I'm reasonably happy with:
~/.vimrc
" Enable reading of local .vimrc / .nvimrc files in working directory
set exrc
[...]
" At the very bottom of the file:
set secure
~/Projects/MyProject/.vimrc
set runtimepath^=.vim
Snippets can then go in ~/Projects/MyProject/.vim/UltiSnips
.
I do think this would be much easier if UltiSnips had an option to search for snippets from the CWD upwards. Either way, this seems to me like it would be quite a common usecase -- maybe worth documenting?
set exrc
is not safe, see https://github.com/vim/vim/issues/1015
Here's a safer alternative: https://github.com/MarcWeber/vim-addon-local-vimrc/
I came across Issue #222, but I'm surprised that no-one else seems to have yet raised this usecase:
I would like to define some boilerplate for test files in a project. However, the setup for a given project is likely to be quite unique, so I'd like to define the snippet in a directory that is loaded only for that project.
The most obvious solution to me seems to be for UltiSnips to check the current working directory and parent directories for UltiSnips directories. Or is there a better solution to this that still uses runpaths?