Merge branch 'bug_1179630/autodetect_path_search_order' of git://github.com/saikobee/ultisnips into saikobee-bug_1179630/autodetect_path_search_order

This commit is contained in:
Holger Rapp 2014-01-05 08:02:42 +01:00
commit 728cec37d1

View File

@ -32,18 +32,19 @@ def _snippets_dir_is_before_plugin_dir():
""" Returns True if the snippets directory comes before the plugin
directory in Vim's runtime path. False otherwise.
"""
paths = [ os.path.expanduser(p).rstrip(os.path.sep)
paths = [ os.path.realpath(os.path.expanduser(p)).rstrip(os.path.sep)
for p in _vim.eval("&runtimepath").split(',') ]
home = _vim.eval("$HOME")
def vim_path_index(suffix):
path = os.path.join(home, suffix).rstrip(os.path.sep)
path = os.path.realpath(os.path.join(home, suffix)).rstrip(os.path.sep)
try:
return paths.index(path)
except ValueError:
return -1
try:
real_vim_path_index = max(vim_path_index(".vim"), vim_path_index("vimfiles"))
return paths.index(_plugin_dir()) < real_vim_path_index
plugin_path_index = paths.index(_plugin_dir())
return plugin_path_index < real_vim_path_index
except ValueError:
return False