mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-06 18:54:44 +08:00
turn syntax highlighting on again if it's turned off by renaming (possible vim bug).
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user