Only use vim.bindeval() if it exists

This commit is contained in:
Marius Gedminas 2016-09-16 23:25:15 +03:00
parent 2098788e69
commit 9c39aa1bbd

View File

@ -250,7 +250,13 @@ def _unmap_select_mode_mapping():
'| redir END')
# Check if any mappings where found
all_maps = list(filter(len, bindeval(r"_tmp_smaps").splitlines()))
if hasattr(vim, 'bindeval'):
# Safer to use bindeval, if it exists, because it can deal with
# non-UTF-8 characters in mappings; see GH #690.
all_maps = bindeval(r"_tmp_smaps")
else:
all_maps = eval(r"_tmp_smaps")
all_maps = list(filter(len, all_maps.splitlines()))
if len(all_maps) == 1 and all_maps[0][0] not in ' sv':
# "No maps found". String could be localized. Hopefully
# it doesn't start with any of these letters in any