From 69e4cead81d54c25f42dcea5c5820c1c4660e52d Mon Sep 17 00:00:00 2001 From: David Halter Date: Mon, 14 Jan 2013 15:37:59 +0100 Subject: [PATCH] turn syntax highlighting on again if it's turned off by renaming (possible vim bug). --- autoload/jedi.vim | 3 +++ jedi | 2 +- plugin/jedi_vim.py | 10 +++------- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/autoload/jedi.vim b/autoload/jedi.vim index f6cba10..aa37298 100644 --- a/autoload/jedi.vim +++ b/autoload/jedi.vim @@ -96,6 +96,9 @@ function! jedi#new_buffer(path) endif Python vim.command('edit ' + jedi_vim.escape_file_path(vim.eval('a:path'))) endif + " sometimes syntax is being disabled and the filetype not set. + syntax on + set filetype=python endfunction function! s:add_goto_window() diff --git a/jedi b/jedi index 89bd32e..ce1653d 160000 --- a/jedi +++ b/jedi @@ -1 +1 @@ -Subproject commit 89bd32e0d7397955afa271371f182a2c4aedbe74 +Subproject commit ce1653df46fdbaa5ee5d8525fa54f4e806fefa9d diff --git a/plugin/jedi_vim.py b/plugin/jedi_vim.py index cd34b29..a4a60a7 100644 --- a/plugin/jedi_vim.py +++ b/plugin/jedi_vim.py @@ -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):