do not walk &rtp if abs path to snips specified

This commit is contained in:
Stanislav Seletskiy 2014-12-06 23:43:46 +06:00
parent 6a787cdc7b
commit b47e686521
2 changed files with 21 additions and 2 deletions

View File

@ -193,6 +193,13 @@ g:UltiSnipsSnippetsDir
directories named "snippets" are reserved for
snipMate snippets and cannot be used.
*g:UltiSnipsSnippetDirectories*
g:UltiSnipsSnippetDirectories
Defines the directories for looking for snippets.
Do not mix up this variable with previous one.
More information about that variable can
be found at section |UltiSnips-snippet-search-path|.
*g:UltiSnipsEnableSnipMate*
g:UltiSnipsEnableSnipMate
Enable looking for SnipMate snippets in
@ -350,6 +357,15 @@ over the global variable.
|UltiSnips-adding-snippets| explains which files are parsed for a given filetype.
If only one directory is specified in this variable and this directory is
specified by absolute path, UltiSnips will not look for snippets in
&runtimepath, which can lead to significant speedup. So, the common case is:
let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips']
However, you will not able to use snippets that are shipped with third party
plugins out of the box. You'll need to copy them into your chosen directory.
3.4 Warning About Select Mode Mappings *UltiSnips-warning-smappings*
--------------------------------------

View File

@ -32,10 +32,13 @@ def find_all_snippet_files(ft):
snippet_dirs = _vim.eval('b:UltiSnipsSnippetDirectories')
else:
snippet_dirs = _vim.eval('g:UltiSnipsSnippetDirectories')
if len(snippet_dirs) == 1 and os.path.isabs(snippet_dirs[0]):
check_dirs = ['']
else:
check_dirs = _vim.eval('&runtimepath').split(',')
patterns = ['%s.snippets', '%s_*.snippets', os.path.join('%s', '*')]
ret = set()
for rtp in _vim.eval('&runtimepath').split(','):
for rtp in check_dirs:
for snippet_dir in snippet_dirs:
if snippet_dir == 'snippets':
raise RuntimeError(