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

View File

@ -22,23 +22,25 @@ def _plugin_dir():
be updated if the code moves.
"""
d = __file__
for i in xrange(3):
for i in xrange(10):
d = os.path.dirname(d)
return d
if os.path.isdir(os.path.join(d, "plugin")) and os.path.isdir(os.path.join(d, "doc")):
return d
raise Exception("Unable to find the plugin directory.")
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)
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)
try:
return paths.index(path)
except ValueError:
return -1
paths = [ os.path.expanduser(p).rstrip(os.path.sep)
for p in _vim.eval("&runtimepath").split(',') ]
home = _vim.eval("$HOME")
try:
real_vim_path_index = max(vim_path_index(".vim"), vim_path_index("vimfiles"))
return paths.index(_plugin_dir()) < real_vim_path_index