forked from VimPlug/jedi-vim
add param for rename function to switch each case as discussed in #7
This commit is contained in:
9
jedi.vim
9
jedi.vim
@@ -95,10 +95,11 @@ endfunction
|
|||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
" rename
|
" rename
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
function! jedi#rename()
|
function! jedi#rename(start_renaming)
|
||||||
python << PYTHONEOF
|
python << PYTHONEOF
|
||||||
if 1:
|
if 1:
|
||||||
if temp_rename is None:
|
start_renaming = int(vim.eval('a:start_renaming'))
|
||||||
|
if start_renaming == 0:
|
||||||
temp_rename = _goto(is_related_name=True, no_output=True)
|
temp_rename = _goto(is_related_name=True, no_output=True)
|
||||||
_rename_cursor = vim.current.window.cursor
|
_rename_cursor = vim.current.window.cursor
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ if 1:
|
|||||||
vim.current.window.cursor = _rename_cursor
|
vim.current.window.cursor = _rename_cursor
|
||||||
|
|
||||||
vim.command('augroup jedi_rename')
|
vim.command('augroup jedi_rename')
|
||||||
vim.command('autocmd InsertLeave * call jedi#rename()')
|
vim.command('autocmd InsertLeave * call jedi#rename(1)')
|
||||||
vim.command('augroup END')
|
vim.command('augroup END')
|
||||||
|
|
||||||
vim.command('normal! diw')
|
vim.command('normal! diw')
|
||||||
@@ -331,7 +332,7 @@ if g:jedi#auto_initialization
|
|||||||
autocmd FileType python execute "noremap <buffer>".g:jedi#get_definition_command." :call jedi#get_definition()<CR>"
|
autocmd FileType python execute "noremap <buffer>".g:jedi#get_definition_command." :call jedi#get_definition()<CR>"
|
||||||
autocmd FileType python execute "noremap <buffer>".g:jedi#related_names_command." :call jedi#related_names()<CR>"
|
autocmd FileType python execute "noremap <buffer>".g:jedi#related_names_command." :call jedi#related_names()<CR>"
|
||||||
" rename
|
" rename
|
||||||
autocmd FileType python execute "noremap <buffer>".g:jedi#rename_command." :call jedi#rename()<CR>"
|
autocmd FileType python execute "noremap <buffer>".g:jedi#rename_command." :call jedi#rename(0)<CR>"
|
||||||
" pydoc
|
" pydoc
|
||||||
autocmd FileType python execute "nnoremap <silent> <buffer>".g:jedi#pydoc." :call jedi#show_pydoc()<CR>"
|
autocmd FileType python execute "nnoremap <silent> <buffer>".g:jedi#pydoc." :call jedi#show_pydoc()<CR>"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user