diff --git a/powerline/matchers/plugin/ctrlp.py b/powerline/matchers/plugin/ctrlp.py index 525a0d95..50b374a7 100644 --- a/powerline/matchers/plugin/ctrlp.py +++ b/powerline/matchers/plugin/ctrlp.py @@ -3,23 +3,17 @@ import os import vim -vim.command(''' -function! Powerline_plugin_ctrlp_main(...) +vim.command('''function! Powerline_plugin_ctrlp_main(...) let b:powerline_ctrlp_type = 'main' let b:powerline_ctrlp_args = a:000 -endfunction -''') +endfunction''') -vim.command(''' -function! Powerline_plugin_ctrlp_prog(...) +vim.command('''function! Powerline_plugin_ctrlp_prog(...) let b:powerline_ctrlp_type = 'prog' let b:powerline_ctrlp_args = a:000 -endfunction -''') +endfunction''') -vim.command(''' -let g:ctrlp_status_func = { 'main': 'Powerline_plugin_ctrlp_main', 'prog': 'Powerline_plugin_ctrlp_prog' } -''') +vim.command('''let g:ctrlp_status_func = { 'main': 'Powerline_plugin_ctrlp_main', 'prog': 'Powerline_plugin_ctrlp_prog' }''') def ctrlp(matcher_info): diff --git a/powerline/segments/plugin/ctrlp.py b/powerline/segments/plugin/ctrlp.py index f696f233..6e624216 100644 --- a/powerline/segments/plugin/ctrlp.py +++ b/powerline/segments/plugin/ctrlp.py @@ -1,20 +1,14 @@ # vim:fileencoding=utf-8:noet import vim +from powerline.bindings.vim import getbufvar -def ctrlp_left(pl): - ctrlp_type = vim.eval('getbufvar("%", "powerline_ctrlp_type")') - ctrlp_args = vim.eval('getbufvar("%", "powerline_ctrlp_args")') +def ctrlp(pl, side): + ctrlp_type = getbufvar('%', 'powerline_ctrlp_type') + ctrlp_args = getbufvar('%', 'powerline_ctrlp_args') - return globals()['ctrlp_stl_left_' + ctrlp_type](pl, *ctrlp_args) - - -def ctrlp_right(pl): - ctrlp_type = vim.eval('getbufvar("%", "powerline_ctrlp_type")') - ctrlp_args = vim.eval('getbufvar("%", "powerline_ctrlp_args")') - - return globals()['ctrlp_stl_right_' + ctrlp_type](pl, *ctrlp_args) + return globals()['ctrlp_stl_{0}_{1}'.format(side, ctrlp_type)](pl, *ctrlp_args) def ctrlp_stl_left_main(pl, focus, byfname, regex, prev, item, next, marked): diff --git a/powerline/segments/plugin/nerdtree.py b/powerline/segments/plugin/nerdtree.py index 466aad72..c12ce777 100644 --- a/powerline/segments/plugin/nerdtree.py +++ b/powerline/segments/plugin/nerdtree.py @@ -2,12 +2,13 @@ import vim +from powerline.bindings.vim import getbufvar from powerline.segments.vim import window_cached @window_cached def nerdtree(pl): - ntr = vim.eval('getbufvar("%", "NERDTreeRoot")') + ntr = getbufvar('%', 'NERDTreeRoot') if not ntr: return path_str = vim.eval('getbufvar("%", "NERDTreeRoot").path.str()')