Buffer local overwrite for snippet directory. Patch by jszakmeister.

This commit is contained in:
Holger Rapp 2013-06-19 08:00:52 +02:00
parent 291a0804a7
commit 3b2eb436b7
2 changed files with 9 additions and 1 deletions

View File

@ -331,6 +331,10 @@ If you do not want to use the snippets that come with UltiSnips, define the
variable accordingly. >
let g:UltiSnipsSnippetDirectories=["mycoolsnippets"]
You can also redefine the search path on a buffer by buffer basis by setting
the variable b:UltiSnipsSnippetDirectories. This variable takes precedence
over the global variable.
UltiSnips searches in 'runtimepath' for snippet directories but traverses
'runtimepath' in reverse order (last item first). If you would like to have
UltiSnips traverse 'runtimepath' in the standard order, add this to your vimrc
@ -1363,6 +1367,7 @@ Contributors listed in chronological order:
David Briscoe - DavidBriscoe
Keith Welch - paralogiki
Zhao Cai - zhaocai
John Szakmeister - jszakmeister
8.2 Snippets *UltiSnips-contrisnippets*

View File

@ -937,7 +937,10 @@ class SnippetManager(object):
the filetype.
"""
snippet_dirs = _vim.eval("g:UltiSnipsSnippetDirectories")
if _vim.eval("exists('b:UltiSnipsSnippetDirectories')") == "1":
snippet_dirs = _vim.eval("b:UltiSnipsSnippetDirectories")
else:
snippet_dirs = _vim.eval("g:UltiSnipsSnippetDirectories")
base_snippets = os.path.realpath(os.path.join(__file__, "../../../UltiSnips"))
ret = []