Closed jamescherti closed 1 year ago
So that would just not delete the word under the cursor initially, but otherwise work pretty much the same? Because we have been discussing internally to have two different ways of doing renames anyway.
That is right, @davidhalter . The behavior is the same as before, but if you set g:jedi#rename_command_reuse_name
or b:jedi_rename_command_reuse_name
to 1, the rename command will not delete the word under the cursor anymore. It will move the cursor to the end of the word and switch to insert mode instead, which allows the user to edit it.
This pull request will make it easier for the user to edit long variable, function or class names.
FYI: I just added the support for set selection=exclusive
to the function rename_visual()
(bug fix).
Hmmm I feel like we should probably have a different command for what you are trying to accomplish. Currently the default is <leader>r
for rename and I feel like we should do something like a <leader>R
to do what you want. Because I agree with what you are trying to achieve, I would just prefer a different command entirely.
What do you think?
Good idea, @davidhalter . Please check the latest commit.
Tested and looks good to me, thanks a lot!
Thank you for merging!
This pull request adds the key mapping
<Leader>R
(upper case R) to rename variables/functions/classes without deleting the word under the cursor:<Leader>R
in Normal mode: Jedi-vim keeps the word under the cursor, moves the cursor to the end of the word, and puts Vim in insert mode, where the user is expected to enter the new variable name.<Leader>R
in Visual mode: Use the selected text as the default answer to the prompt.Bug fix: This pull request also adds the support for
set selection=exclusive
to the functionrename_visual()