Merge pull request #1245 from ZyX-I/drop-ctrlp

Remove Control-P plugin support
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2015-01-06 14:55:32 +03:00
commit 4cef8669bd
8 changed files with 0 additions and 212 deletions

View File

@ -15,12 +15,6 @@ Syntastic segments
.. automodule:: powerline.segments.vim.plugin.syntastic
:members:
Ctrl-P segments
---------------
.. automodule:: powerline.segments.vim.plugin.ctrlp
:members:
Command-T segments
------------------

View File

@ -35,7 +35,6 @@
"quickfix": "quickfix",
"powerline.matchers.vim.plugin.nerdtree.nerdtree": "plugin_nerdtree",
"powerline.matchers.vim.plugin.ctrlp.ctrlp": "plugin_ctrlp",
"powerline.matchers.vim.plugin.commandt.commandt": "plugin_commandt",
"powerline.matchers.vim.plugin.gundo.gundo": "plugin_gundo",
"powerline.matchers.vim.plugin.gundo.gundo_preview": "plugin_gundo-preview"

View File

@ -1,28 +0,0 @@
{
"default_module": "powerline.segments.vim.plugin.ctrlp",
"segments": {
"left": [
{
"function": "ctrlp",
"args": {
"side": "left"
}
},
{
"type": "string",
"highlight_group": ["ctrlp.background", "background"],
"draw_soft_divider": false,
"draw_hard_divider": false,
"width": "auto"
}
],
"right": [
{
"function": "ctrlp",
"args": {
"side": "right"
}
}
]
}
}

View File

@ -1,33 +0,0 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
from powerline.bindings.vim import buffer_name
try:
import vim
except ImportError:
pass
else:
vim.command('''
function! Powerline_plugin_ctrlp_main(...)
let b:powerline_ctrlp_type = 'main'
let b:powerline_ctrlp_args = a:000
endfunction''')
vim.command('''
function! Powerline_plugin_ctrlp_prog(...)
let b:powerline_ctrlp_type = 'prog'
let b:powerline_ctrlp_args = a:000
endfunction''')
vim.command('''
let g:ctrlp_status_func = {'main': 'Powerline_plugin_ctrlp_main', 'prog': 'Powerline_plugin_ctrlp_prog'}
''')
def ctrlp(matcher_info):
name = buffer_name(matcher_info)
return name and os.path.basename(name) == b'ControlP'

View File

@ -1,116 +0,0 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
try:
import vim
except ImportError:
vim = object()
from powerline.bindings.vim import getbufvar
from powerline.segments.vim import window_cached
@window_cached
def ctrlp(pl, side):
'''
Highlight groups used: ``ctrlp.regex`` or ``background``, ``ctrlp.prev`` or ``background``, ``ctrlp.item`` or ``file_name``, ``ctrlp.next`` or ``background``, ``ctrlp.marked`` or ``background``, ``ctrlp.focus`` or ``background``, ``ctrlp.byfname`` or ``background``, ``ctrlp.progress`` or ``file_name``, ``ctrlp.progress`` or ``file_name``.
'''
ctrlp_type = getbufvar('%', 'powerline_ctrlp_type')
ctrlp_args = getbufvar('%', 'powerline_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):
'''
Highlight groups used: ``ctrlp.regex`` or ``background``, ``ctrlp.prev`` or ``background``, ``ctrlp.item`` or ``file_name``, ``ctrlp.next`` or ``background``, ``ctrlp.marked`` or ``background``.
'''
marked = marked[2:-1]
segments = []
if int(regex):
segments.append({
'contents': 'regex',
'highlight_group': ['ctrlp.regex', 'background'],
})
segments += [
{
'contents': prev + ' ',
'highlight_group': ['ctrlp.prev', 'background'],
'draw_inner_divider': True,
'priority': 40,
},
{
'contents': item,
'highlight_group': ['ctrlp.item', 'file_name'],
'draw_inner_divider': True,
'width': 10,
'align': 'c',
},
{
'contents': ' ' + next,
'highlight_group': ['ctrlp.next', 'background'],
'draw_inner_divider': True,
'priority': 40,
},
]
if marked != '-':
segments.append({
'contents': marked,
'highlight_group': ['ctrlp.marked', 'background'],
'draw_inner_divider': True,
})
return segments
def ctrlp_stl_right_main(pl, focus, byfname, regex, prev, item, next, marked):
'''
Highlight groups used: ``ctrlp.focus`` or ``background``, ``ctrlp.byfname`` or ``background``.
'''
segments = [
{
'contents': focus,
'highlight_group': ['ctrlp.focus', 'background'],
'draw_inner_divider': True,
'priority': 50,
},
{
'contents': byfname,
'highlight_group': ['ctrlp.byfname', 'background'],
'priority': 50,
},
]
return segments
def ctrlp_stl_left_prog(pl, progress):
'''
Highlight groups used: ``ctrlp.progress`` or ``file_name``.
'''
return [
{
'contents': 'Loading...',
'highlight_group': ['ctrlp.progress', 'file_name'],
},
]
def ctrlp_stl_right_prog(pl, progress):
'''
Highlight groups used: ``ctrlp.progress`` or ``file_name``.
'''
return [
{
'contents': str(progress),
'highlight_group': ['ctrlp.progress', 'file_name'],
},
]

View File

@ -1,17 +0,0 @@
#!/usr/bin/vim -S
set nocompatible
set columns=80
execute 'source' fnameescape(expand('<sfile>:p:h').'/vim_utils.vim')
call EnablePlugins('ctrlp')
call SourcePowerline()
let g:statusline_values = []
call PyFile('setup_statusline_catcher')
execute 'CtrlP'|call feedkeys("\<C-c>")
call RunPython('powerline.render = _powerline_old_render')
let g:expected_statusline = '%#Pl_231_16777215_236_3158064_NONE# mru  %#Pl_236_3158064_240_5789784_NONE# %#Pl_231_16777215_240_5789784_bold#  files    %#Pl_240_5789784_236_3158064_NONE# %#Pl_231_16777215_236_3158064_NONE# buf                                          prt  path '
if index(g:statusline_values, g:expected_statusline) == -1
call CheckStatuslineValue(g:statusline_values[-1], g:expected_statusline)
cquit
endif
call CheckMessages()
qall

View File

@ -54,7 +54,6 @@ class TestVimConfig(TestCase):
(('bufname', 'NERD_tree_1'), {}),
(('bufname', '__Gundo__'), {}),
(('bufname', '__Gundo_Preview__'), {}),
(('bufname', 'ControlP'), {}),
# No Command-T tests here: requires +ruby or emulation
# No tabline here: tablines are tested separately
)
@ -95,10 +94,6 @@ class TestVimConfig(TestCase):
i += 1
if mode in exclude:
continue
if mode == 'nc' and args == ('bufname', 'ControlP'):
# ControlP window is not supposed to not
# be in the focus
continue
with vim_module._with(*args, **kwargs):
check_output(mode, args, kwargs)
finally:

View File

@ -191,9 +191,6 @@ def command(cmd):
elif cmd.startswith('hi '):
sp = cmd.split()
_highlights[sp[1]] = sp[2:]
elif cmd.startswith('function! Powerline_plugin_ctrlp'):
# Ignore CtrlP updating functions
pass
elif cmd.startswith('augroup'):
augroup = cmd.partition(' ')[2]
if augroup.upper() == 'END':
@ -858,9 +855,6 @@ class _WithBufName(object):
self.buffer = buffer
self.old = buffer.name
buffer.name = self.new
if buffer.name and os.path.basename(buffer.name) == 'ControlP':
buffer.vars['powerline_ctrlp_type'] = 'main'
buffer.vars['powerline_ctrlp_args'] = ['focus', 'byfname', '0', 'prev', 'item', 'next', 'marked']
def __exit__(self, *args):
self.buffer.name = self.old