Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not prefill GoRename #711

Merged
merged 1 commit into from
Feb 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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