diff --git a/docs/source/overview.rst b/docs/source/overview.rst index be7f2a30..4bc57d9c 100644 --- a/docs/source/overview.rst +++ b/docs/source/overview.rst @@ -64,4 +64,4 @@ location. Add the following line to your ``vimrc``, where ``{path}`` is the path to the main Powerline project directory:: - source {path}/powerline/ext/vim/powerline.vim + source {path}/powerline/ext/vim/source_plugin.vim diff --git a/powerline/ext/vim/__init__.py b/powerline/ext/vim/__init__.py index 189d565d..d79377a6 100644 --- a/powerline/ext/vim/__init__.py +++ b/powerline/ext/vim/__init__.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- + def source_plugin(): import os import vim - vim.command('source ' + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'powerline.vim')) + vim.command('source ' + vim.eval('fnameescape("' + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'powerline.vim') + '")')) diff --git a/powerline/ext/vim/powerline.vim b/powerline/ext/vim/powerline.vim index 0d4e0b02..aabdf3f0 100644 --- a/powerline/ext/vim/powerline.vim +++ b/powerline/ext/vim/powerline.vim @@ -1,13 +1,4 @@ -if ! has('python') - echohl ErrorMsg - echomsg 'You need vim compiled with Python 2 support for Powerline to work. Please consult the documentation for more details.' - echohl None - finish -endif - -python import sys, vim, os -python sys.path.append(vim.eval('expand(":h:h:h:h")')) -python import uuid +python import uuid, vim python from powerline.core import Powerline python pl = Powerline('vim') diff --git a/powerline/ext/vim/source_plugin.vim b/powerline/ext/vim/source_plugin.vim new file mode 100644 index 00000000..87e8b12c --- /dev/null +++ b/powerline/ext/vim/source_plugin.vim @@ -0,0 +1,11 @@ +if ! has('python') + echohl ErrorMsg + echomsg 'You need vim compiled with Python 2 support for Powerline to work. Please consult the documentation for more details.' + echohl None + finish +endif + +python import sys, vim +python sys.path.append(vim.eval('expand(":h:h:h:h")')) + +exec 'source '. fnameescape(expand(':h') . '/powerline.vim')