Do not call mode() with an argument on old Vims

This commit is contained in:
ZyX 2014-08-24 13:21:51 +04:00
parent c2609e31b8
commit 2c8932b084
1 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,10 @@ except ImportError:
vim_mode = vim_get_func('mode', rettype=str)
if int(vim.eval('v:version')) >= 702:
_vim_mode = vim_mode
vim_mode = lambda: _vim_mode(1)
mode_translations = {
chr(ord('V') - 0x40): '^V',
chr(ord('S') - 0x40): '^S',
@ -89,7 +93,7 @@ class VimRenderer(Renderer):
segment_info = self.segment_info.copy()
if window is vim.current.window:
mode = vim_mode(1)
mode = vim_mode()
mode = mode_translations.get(mode, mode)
else:
mode = 'nc'