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

gorename: create and populate errors in quickfix window #577

Merged
merged 1 commit into from
Oct 18, 2015
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
12 changes: 10 additions & 2 deletions autoload/go/rename.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if !exists("g:go_gorename_bin")
let g:go_gorename_bin = "gorename"
endif

function! go#rename#Rename(...)
function! go#rename#Rename(bang, ...)
let to = ""
if a:0 == 0
let from = expand("<cword>")
Expand Down Expand Up @@ -31,8 +31,16 @@ function! go#rename#Rename(...)
let clean = split(out, '\n')

if v:shell_error
redraw | echon "vim-go: " | echohl Statement | echon clean[0] | echohl None
call go#tool#ShowErrors(out)
cwindow
let errors = getqflist()
if !empty(errors) && !a:bang
cc 1 "jump to first error if there is any
endif
return
else
call setqflist([])
cwindow
redraw | echon "vim-go: " | echohl Function | echon clean[0] | echohl None
endif

Expand Down
4 changes: 3 additions & 1 deletion doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,13 @@ COMMANDS *go-commands*
for the type that implements an interface under the cursor (or selected
package) is shown quickfix list.
*:GoRename*
:GoRename [to]
:GoRename[!] [to]

Rename the identifier under the cursor to the desired new name. If no
argument is given a prompt will ask for the desired identifier.

If [!] is not given the first error is jumped to.


*:GoOracleScope*
:GoOracleScope [path1] [path2] ...
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/go/commands.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
" gorename
command! -nargs=? GoRename call go#rename#Rename(<f-args>)
command! -nargs=? GoRename call go#rename#Rename(<bang>0,<f-args>)

" oracle
command! -nargs=* -complete=customlist,go#package#Complete GoOracleScope call go#oracle#Scope(<f-args>)
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/go/mappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ nnoremap <silent> <Plug>(go-freevars) :<C-u>call go#oracle#Freevars(-1)<CR>
nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#oracle#ChannelPeers(-1)<CR>
nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#oracle#Referrers(-1)<CR>

nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename()<CR>
nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename(!g:go_jump_to_error)<CR>

nnoremap <silent> <Plug>(go-def) :<C-u>call go#def#Jump()<CR>
nnoremap <silent> <Plug>(go-def-vertical) :<C-u>call go#def#JumpMode("vsplit")<CR>
Expand Down