Add option to not traverse all of the rtp.

This commit is contained in:
Holger Rapp 2015-01-22 08:15:37 +01:00
commit d693259abb
2 changed files with 21 additions and 2 deletions

View File

@ -193,6 +193,13 @@ g:UltiSnipsSnippetsDir
directories named "snippets" are reserved for directories named "snippets" are reserved for
snipMate snippets and cannot be used. 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*
g:UltiSnipsEnableSnipMate g:UltiSnipsEnableSnipMate
Enable looking for SnipMate snippets in 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. |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* 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') snippet_dirs = _vim.eval('b:UltiSnipsSnippetDirectories')
else: else:
snippet_dirs = _vim.eval('g:UltiSnipsSnippetDirectories') 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', '*')] patterns = ['%s.snippets', '%s_*.snippets', os.path.join('%s', '*')]
ret = set() ret = set()
for rtp in _vim.eval('&runtimepath').split(','): for rtp in check_dirs:
for snippet_dir in snippet_dirs: for snippet_dir in snippet_dirs:
if snippet_dir == 'snippets': if snippet_dir == 'snippets':
raise RuntimeError( raise RuntimeError(