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

handle :GoDef from modified buffer #1132

Merged
merged 1 commit into from
Dec 17, 2016
Merged
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
30 changes: 19 additions & 11 deletions autoload/go/def.vim
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,27 @@ function! s:jump_to_declaration(out, mode, bin_name) abort
if get(g:, 'go_def_reuse_buffer', 0) && bufloaded(filename) != 0 && bufwinnr(filename) != -1
" jumpt to existing buffer if it exists
execute bufwinnr(filename) . 'wincmd w'
elseif a:mode == "tab"
let &switchbuf = "usetab"
if bufloaded(filename) == 0
tab split
else
if &modified
let cmd = 'hide edit'
else
let cmd = 'edit'
endif
elseif a:mode == "split"
split
elseif a:mode == "vsplit"
vsplit
endif

" open the file and jump to line and column
exec 'edit' filename
if a:mode == "tab"
let &switchbuf = "usetab"
if bufloaded(filename) == 0
tab split
endif
elseif a:mode == "split"
split
elseif a:mode == "vsplit"
vsplit
endif

" open the file and jump to line and column
exec cmd filename
endif
endif
call cursor(line, col)

Expand Down