Skip to content

Commit

Permalink
substitute all backslashes to slashes for filename.
Browse files Browse the repository at this point in the history
related issue fatih#670
  • Loading branch information
mattn committed Feb 8, 2016
1 parent 51ecdd1 commit 20386a1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions autoload/go/def.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ function! go#def#Jump(...)
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()

let command = bin_path . " -f=" . shellescape(expand("%:p")) . " -i " . shellescape(arg)
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
let command = bin_path . " -f=" . shellescape(fname) . " -i " . shellescape(arg)

" get output of godef
let out=s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding()))
let out = s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding()))

" jump to it
call s:godefJump(out, "")
Expand All @@ -52,10 +53,11 @@ function! go#def#JumpMode(mode)
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()

let command = bin_path . " -f=" . shellescape(expand("%:p")) . " -i " . shellescape(arg)
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
let command = bin_path . " -f=" . shellescape(fname) . " -i " . shellescape(arg)

" get output of godef
let out=s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding()))
let out = s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding()))

call s:godefJump(out, a:mode)
let $GOPATH = old_gopath
Expand Down Expand Up @@ -83,7 +85,7 @@ function! s:godefJump(out, mode)
let &errorformat = "%f:%l:%c"

if a:out =~ 'godef: '
let out=substitute(a:out, go#util#LineEnding() . '$', '', '')
let out = substitute(a:out, go#util#LineEnding() . '$', '', '')
echom out
else
let parts = split(a:out, ':')
Expand Down

0 comments on commit 20386a1

Please sign in to comment.