Skip to content

Commit

Permalink
Merge pull request #1296 from fatih/term-neovim-fix
Browse files Browse the repository at this point in the history
term: fix cwd after running command
  • Loading branch information
fatih authored May 28, 2017
2 parents ff3c10e + 4fda596 commit b8a6dc9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions autoload/go/term.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function! go#term#newmode(bang, cmd, mode) abort
let $GOPATH = go#path#Detect()

" execute go build in the files directory
let l:winnr = winnr()
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()

Expand All @@ -47,6 +48,10 @@ function! go#term#newmode(bang, cmd, mode) abort

let id = termopen(a:cmd, job)

if l:winnr !=# winnr()
exe l:winnr . "wincmd w"
endif

execute cd . fnameescape(dir)

" restore back GOPATH
Expand Down

0 comments on commit b8a6dc9

Please sign in to comment.