diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index d15180d..f4295c0 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -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. diff --git a/plugin/UltiSnips/__init__.py b/plugin/UltiSnips/__init__.py index 6fadd6d..2caf000 100644 --- a/plugin/UltiSnips/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -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