Skip to content

Commit

Permalink
Merge pull request #711 from nhooyr/no-prepopulate-gorename
Browse files Browse the repository at this point in the history
Do not prefill GoRename
  • Loading branch information
fatih committed Feb 5, 2016
2 parents 198a400 + accc895 commit c487f16
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
21 changes: 16 additions & 5 deletions autoload/go/rename.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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("<cword>")
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')
Expand Down
7 changes: 7 additions & 0 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
<


===============================================================================
Expand Down

0 comments on commit c487f16

Please sign in to comment.