mirror of
https://github.com/powerline/powerline.git
synced 2025-07-24 22:36:01 +02:00
Update plugin segments to use bindings
This commit is contained in:
parent
6baf1f8e90
commit
e19a63aaa9
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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()')
|
||||
|
Loading…
x
Reference in New Issue
Block a user