mirror of
https://github.com/powerline/powerline.git
synced 2025-07-30 17:25:28 +02:00
Move the vim example to a separate plugin folder
When Powerline is installed as a package in the system-wide site-packages folder it can easily be enabled by adding a simple python statement to the user's vimrc file. Otherwise it can be added by doing a :source path/to/plugin/vim/powerline.vim in vimrc, but the other way of doing it works without specifying the full path as long as Powerline is installed somewhere in sys.path.
This commit is contained in:
parent
175fb1b58e
commit
f074c1fb29
@ -1,2 +1,3 @@
|
|||||||
recursive-include powerline *.json
|
recursive-include powerline *.json
|
||||||
|
recursive-include plugin *.vim
|
||||||
exclude powerline/tests/*.xml
|
exclude powerline/tests/*.xml
|
||||||
|
0
plugin/vim/__init__.py
Normal file
0
plugin/vim/__init__.py
Normal file
4
plugin/vim/load_vim_plugin.py
Normal file
4
plugin/vim/load_vim_plugin.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import os
|
||||||
|
import vim
|
||||||
|
|
||||||
|
vim.command('source ' + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'powerline.vim'))
|
@ -1,5 +1,9 @@
|
|||||||
" Powerline vim example
|
" Powerline vim plugin
|
||||||
" Run with :source %
|
"
|
||||||
|
" If Powerline is installed in a Python search path, load the plugin by
|
||||||
|
" adding the following line to your .vimrc:
|
||||||
|
"
|
||||||
|
" python import plugin.vim.load_vim_plugin
|
||||||
|
|
||||||
python import sys, vim, os
|
python import sys, vim, os
|
||||||
python sys.path.append(vim.eval('expand("<sfile>:h:h:h")'))
|
python sys.path.append(vim.eval('expand("<sfile>:h:h:h")'))
|
||||||
@ -22,14 +26,14 @@ endfunction
|
|||||||
function! s:UpdateAllWindows()
|
function! s:UpdateAllWindows()
|
||||||
for w in range(1, winnr('$'))
|
for w in range(1, winnr('$'))
|
||||||
" getwinvar() returns empty string for undefined variables.
|
" getwinvar() returns empty string for undefined variables.
|
||||||
" Use has_key(getwinvar(w, ''), 'powerline') if you care about variable
|
" Use has_key(getwinvar(w, ''), 'powerline') if you care about variable
|
||||||
" being really defined (currently with w:powerline=='' it will throw
|
" being really defined (currently with w:powerline=='' it will throw
|
||||||
" E706: variable type mismatch).
|
" E706: variable type mismatch).
|
||||||
if getwinvar(w, 'powerline') is# ''
|
if getwinvar(w, 'powerline') is# ''
|
||||||
call setwinvar(w, 'powerline', {})
|
call setwinvar(w, 'powerline', {})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call setwinvar(w, '&statusline', '%!Powerline('.w.')')
|
call setwinvar(w, '&statusline', '%!Powerline('. w .')')
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -38,4 +42,3 @@ augroup Powerline
|
|||||||
autocmd BufEnter,BufWinEnter,WinEnter * let w:current = 1 | call s:UpdateAllWindows()
|
autocmd BufEnter,BufWinEnter,WinEnter * let w:current = 1 | call s:UpdateAllWindows()
|
||||||
autocmd BufLeave,BufWinLeave,WinLeave * let w:current = 0
|
autocmd BufLeave,BufWinLeave,WinLeave * let w:current = 0
|
||||||
augroup END
|
augroup END
|
||||||
" vim: ft=vim noet
|
|
Loading…
x
Reference in New Issue
Block a user