Move translation of modes into renderers/vim.py

Fixes #147
This commit is contained in:
ZyX 2013-02-24 15:29:31 +04:00
parent 3c62e060be
commit 2fa64c42d1
2 changed files with 5 additions and 6 deletions

View File

@ -11,6 +11,10 @@ import vim
vim_mode = vim_get_func('mode')
vim_getwinvar = vim_get_func('getwinvar')
vim_setwinvar = vim_get_func('setwinvar')
mode_translations = {
chr(ord('V') - 0x40): '^V',
chr(ord('S') - 0x40): '^S',
}
class VimRenderer(Renderer):
@ -29,6 +33,7 @@ class VimRenderer(Renderer):
'''
if current:
mode = vim_mode()
mode = mode_translations.get(mode, mode)
else:
mode = 'nc'
segment_info = {

View File

@ -43,11 +43,6 @@ vim_modes = {
'!': u'SHELL',
}
mode_translations = {
chr(ord('V') - 0x40): '^V',
chr(ord('S') - 0x40): '^S',
}
eventcaches = defaultdict(lambda: [])
bufeventcaches = defaultdict(lambda: [])
@ -111,7 +106,6 @@ def mode(segment_info, override=None):
mode = segment_info['mode']
if mode == 'nc':
return None
mode = mode_translations.get(mode, mode)
if not override:
return vim_modes[mode]
try: