diff --git a/autoload/go/rename.vim b/autoload/go/rename.vim index 3212f0760e..4c8e063061 100644 --- a/autoload/go/rename.vim +++ b/autoload/go/rename.vim @@ -2,21 +2,32 @@ if !exists("g:go_gorename_bin") let g:go_gorename_bin = "gorename" endif +if !exists("g:go_gorename_prefill") + let g:go_gorename_prefill = 1 +endif + function! go#rename#Rename(bang, ...) let to = "" if a:0 == 0 let from = expand("") let ask = printf("vim-go: rename '%s' to: ", from) - let to = input(ask, from) - redraw + if g:go_gorename_prefill + let to = input(ask, from) + else + let to = input(ask) + endif + redraw! + if empty(to) + return + endif else let to = a:1 endif "return with a warning if the bin doesn't exist - let bin_path = go#path#CheckBinPath(g:go_gorename_bin) - if empty(bin_path) - return + let bin_path = go#path#CheckBinPath(g:go_gorename_bin) + if empty(bin_path) + return endif let fname = expand('%:p') diff --git a/doc/vim-go.txt b/doc/vim-go.txt index c63ff34f00..aa629a2c26 100644 --- a/doc/vim-go.txt +++ b/doc/vim-go.txt @@ -1054,6 +1054,13 @@ It is by default set to edit. > let g:go_alternate_mode = "edit" < + *g:go_gorename_prefill* + +Specifies whether |:GoRename| prefills the new identifer name with the +word under the cursor. By default is is on. +> + let g:go_gorename_prefill = 1 +< ===============================================================================