turn syntax highlighting on again if it's turned off by renaming (possible vim bug).

This commit is contained in:
David Halter
2013-01-14 15:37:59 +01:00
parent ef1011d8c6
commit 69e4cead81
3 changed files with 7 additions and 8 deletions

View File

@@ -12,8 +12,6 @@ import jedi
import jedi.keywords
from jedi._compatibility import unicode
temp_rename = None # used for jedi#rename
class PythonToVimStr(unicode):
""" Vim has a different string implementation of single quotes """
@@ -257,9 +255,7 @@ def show_func_def(call_def=None, completion_lines=0):
def rename():
global temp_rename
if not int(vim.eval('a:0')):
temp_rename = goto(is_related_name=True, no_output=True)
_rename_cursor = vim.current.window.cursor
vim.command('normal A ') # otherwise startinsert doesn't work well
@@ -284,6 +280,7 @@ def rename():
if replace is None:
echo_highlight('No rename possible, if no name is given.')
else:
temp_rename = goto(is_related_name=True, no_output=True)
# sort the whole thing reverse (positions at the end of the line
# must be first, because they move the stuff before the position).
temp_rename = sorted(temp_rename, reverse=True,
@@ -291,17 +288,16 @@ def rename():
for r in temp_rename:
if r.in_builtin_module():
continue
if vim.current.buffer.name != r.module_path:
vim.eval("jedi#new_buffer('%s')" % r.module_path)
vim.current.window.cursor = r.start_pos
vim.command('normal! cw%s' % replace)
vim.current.window.cursor = cursor
vim.eval("jedi#new_buffer('%s')" % window_path)
vim.current.window.cursor = cursor
echo_highlight('Jedi did %s renames!' % len(temp_rename))
# reset rename variables
temp_rename = None
def tabnew(path):