mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-08 03:24:47 +08:00
turn syntax highlighting on again if it's turned off by renaming (possible vim bug).
This commit is contained in:
@@ -96,6 +96,9 @@ function! jedi#new_buffer(path)
|
|||||||
endif
|
endif
|
||||||
Python vim.command('edit ' + jedi_vim.escape_file_path(vim.eval('a:path')))
|
Python vim.command('edit ' + jedi_vim.escape_file_path(vim.eval('a:path')))
|
||||||
endif
|
endif
|
||||||
|
" sometimes syntax is being disabled and the filetype not set.
|
||||||
|
syntax on
|
||||||
|
set filetype=python
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:add_goto_window()
|
function! s:add_goto_window()
|
||||||
|
|||||||
2
jedi
2
jedi
Submodule jedi updated: 89bd32e0d7...ce1653df46
@@ -12,8 +12,6 @@ import jedi
|
|||||||
import jedi.keywords
|
import jedi.keywords
|
||||||
from jedi._compatibility import unicode
|
from jedi._compatibility import unicode
|
||||||
|
|
||||||
temp_rename = None # used for jedi#rename
|
|
||||||
|
|
||||||
|
|
||||||
class PythonToVimStr(unicode):
|
class PythonToVimStr(unicode):
|
||||||
""" Vim has a different string implementation of single quotes """
|
""" 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():
|
def rename():
|
||||||
global temp_rename
|
|
||||||
if not int(vim.eval('a:0')):
|
if not int(vim.eval('a:0')):
|
||||||
temp_rename = goto(is_related_name=True, no_output=True)
|
|
||||||
_rename_cursor = vim.current.window.cursor
|
_rename_cursor = vim.current.window.cursor
|
||||||
|
|
||||||
vim.command('normal A ') # otherwise startinsert doesn't work well
|
vim.command('normal A ') # otherwise startinsert doesn't work well
|
||||||
@@ -284,6 +280,7 @@ def rename():
|
|||||||
if replace is None:
|
if replace is None:
|
||||||
echo_highlight('No rename possible, if no name is given.')
|
echo_highlight('No rename possible, if no name is given.')
|
||||||
else:
|
else:
|
||||||
|
temp_rename = goto(is_related_name=True, no_output=True)
|
||||||
# sort the whole thing reverse (positions at the end of the line
|
# sort the whole thing reverse (positions at the end of the line
|
||||||
# must be first, because they move the stuff before the position).
|
# must be first, because they move the stuff before the position).
|
||||||
temp_rename = sorted(temp_rename, reverse=True,
|
temp_rename = sorted(temp_rename, reverse=True,
|
||||||
@@ -291,17 +288,16 @@ def rename():
|
|||||||
for r in temp_rename:
|
for r in temp_rename:
|
||||||
if r.in_builtin_module():
|
if r.in_builtin_module():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if vim.current.buffer.name != r.module_path:
|
if vim.current.buffer.name != r.module_path:
|
||||||
vim.eval("jedi#new_buffer('%s')" % r.module_path)
|
vim.eval("jedi#new_buffer('%s')" % r.module_path)
|
||||||
|
|
||||||
vim.current.window.cursor = r.start_pos
|
vim.current.window.cursor = r.start_pos
|
||||||
vim.command('normal! cw%s' % replace)
|
vim.command('normal! cw%s' % replace)
|
||||||
|
|
||||||
vim.current.window.cursor = cursor
|
|
||||||
vim.eval("jedi#new_buffer('%s')" % window_path)
|
vim.eval("jedi#new_buffer('%s')" % window_path)
|
||||||
|
vim.current.window.cursor = cursor
|
||||||
echo_highlight('Jedi did %s renames!' % len(temp_rename))
|
echo_highlight('Jedi did %s renames!' % len(temp_rename))
|
||||||
# reset rename variables
|
|
||||||
temp_rename = None
|
|
||||||
|
|
||||||
|
|
||||||
def tabnew(path):
|
def tabnew(path):
|
||||||
|
|||||||
Reference in New Issue
Block a user