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

Some improvements for :GoRun #1703

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 13 additions & 1 deletion autoload/go/term.vim
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ function! go#term#newmode(bang, cmd, mode) abort
let mode = g:go_term_mode
endif

if exists("b:goterm_buf_id") && bufloaded(b:goterm_buf_id)
execute("bd! " . b:goterm_buf_id)
unlet b:goterm_buf_id
endif

" execute go build in the files directory
let l:winnr = winnr()
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
Expand Down Expand Up @@ -70,7 +75,9 @@ function! go#term#newmode(bang, cmd, mode) abort
stopinsert

if l:winnr !=# winnr()
let l:bufid = bufnr('%')
exe l:winnr . "wincmd w"
let b:goterm_buf_id = l:bufid
endif

return id
Expand Down Expand Up @@ -115,7 +122,12 @@ function! s:on_exit(job_id, exit_status, event) dict abort

if !empty(errors)
" close terminal we don't need it anymore
close
if exists("b:goterm_buf_id") && bufloaded(b:goterm_buf_id)
execute('bd! ' . b:goterm_buf_id)
unlet b:goterm_buf_id
else
close
endif

call go#list#Populate(l:listtype, errors, job.cmd)
call go#list#Window(l:listtype, len(errors))
Expand Down