Fixed contributors list; saner plugin dir checking.

This commit is contained in:
Brian Mock 2013-12-27 10:21:51 -08:00
parent e9c00a746b
commit bc391a330d
2 changed files with 8 additions and 6 deletions

View File

@ -1395,6 +1395,7 @@ Contributors listed in chronological order:
John Szakmeister - jszakmeister John Szakmeister - jszakmeister
Jonas Diemer - diemer Jonas Diemer - diemer
Romain Giot - rgiot Romain Giot - rgiot
Brian Mock - saikobee
8.2 Snippets *UltiSnips-contrisnippets* 8.2 Snippets *UltiSnips-contrisnippets*
@ -1448,7 +1449,6 @@ Contributors listed in chronological order:
Bernhard Vallant (lazerscience) Bernhard Vallant (lazerscience)
Von Welch (von) Von Welch (von)
Nikola Petrov (nikolavp) Nikola Petrov (nikolavp)
Brian Mock (saikobee)
Thank you for your support. Thank you for your support.

View File

@ -22,23 +22,25 @@ def _plugin_dir():
be updated if the code moves. be updated if the code moves.
""" """
d = __file__ d = __file__
for i in xrange(3): for i in xrange(10):
d = os.path.dirname(d) d = os.path.dirname(d)
if os.path.isdir(os.path.join(d, "plugin")) and os.path.isdir(os.path.join(d, "doc")):
return d return d
raise Exception("Unable to find the plugin directory.")
def _snippets_dir_is_before_plugin_dir(): def _snippets_dir_is_before_plugin_dir():
""" Returns True if the snippets directory comes before the plugin """ Returns True if the snippets directory comes before the plugin
directory in Vim's runtime path. False otherwise. directory in Vim's runtime path. False otherwise.
""" """
paths = [ os.path.expanduser(p).rstrip(os.path.sep)
for p in _vim.eval("&runtimepath").split(',') ]
home = _vim.eval("$HOME")
def vim_path_index(suffix): def vim_path_index(suffix):
path = os.path.join(home, suffix).rstrip(os.path.sep) path = os.path.join(home, suffix).rstrip(os.path.sep)
try: try:
return paths.index(path) return paths.index(path)
except ValueError: except ValueError:
return -1 return -1
paths = [ os.path.expanduser(p).rstrip(os.path.sep)
for p in _vim.eval("&runtimepath").split(',') ]
home = _vim.eval("$HOME")
try: try:
real_vim_path_index = max(vim_path_index(".vim"), vim_path_index("vimfiles")) real_vim_path_index = max(vim_path_index(".vim"), vim_path_index("vimfiles"))
return paths.index(_plugin_dir()) < real_vim_path_index return paths.index(_plugin_dir()) < real_vim_path_index