From efaef9cee3a61b1acbb55a86f0ca59f7728c9ffa Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 15 Oct 2017 15:49:43 +0200 Subject: [PATCH] Rename was in the wrong spot when using it at the end of a line. --- pythonx/jedi_vim.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pythonx/jedi_vim.py b/pythonx/jedi_vim.py index e0ec709..7e5e0f1 100644 --- a/pythonx/jedi_vim.py +++ b/pythonx/jedi_vim.py @@ -608,8 +608,14 @@ def rename(): vim_command('augroup END') vim_command("let s:jedi_replace_orig = expand('')") + line = vim_eval('getline(".")') vim_command('normal! diw') - vim_command('startinsert') + if re.match('\w+$', line[cursor[1]:]): + # In case the deleted word is at the end of the line we need to + # move the cursor to the end. + vim_command('startinsert!') + else: + vim_command('startinsert') else: # Remove autocommand.