From 8afb35bd5d2f69bdaba28b252906eb7923cb6109 Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 11 Nov 2014 00:57:18 +0300 Subject: [PATCH] Use different fallback for old Vims Reasoning: currently used fallback works well only if relatively recent patches are there: specifically the one that transforms Vim errors to Python exceptions. This variant should work in any case, but it has a downside: it does not test whether function exists, it tests whether argument given to vim_func_exists denote some callable object (which may as well be global variable with the same name). When it comes to CapsLockStatusline I do not care much as I am using `vim.eval` to call it and not saving reference to this function somewhere. Fixes #1146 --- powerline/bindings/vim/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerline/bindings/vim/__init__.py b/powerline/bindings/vim/__init__.py index 3f69dfb1..4d59c985 100644 --- a/powerline/bindings/vim/__init__.py +++ b/powerline/bindings/vim/__init__.py @@ -135,7 +135,7 @@ if hasattr(vim, 'Function'): else: def vim_func_exists(f): try: - return bool(int(vim.eval('type(function("{0}")) == 2'.format(f)))) + return bool(int(vim.eval('exists("*{0}")'.format(f)))) except vim.error: return False