mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -13,15 +13,15 @@ function! go#def#Jump(...)
|
||||
let arg = a:1
|
||||
endif
|
||||
|
||||
let bin_path = go#tool#BinPath(g:go_godef_bin)
|
||||
if empty(bin_path)
|
||||
return
|
||||
let bin_path = go#tool#BinPath(g:go_godef_bin)
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
|
||||
let command = bin_path . " -f=" . expand("%:p") . " -i " . shellescape(arg)
|
||||
|
||||
" get output of godef
|
||||
let out=system(command, join(getbufline(bufnr('%'), 1, '$'), "\n"))
|
||||
let out=system(command, join(getbufline(bufnr('%'), 1, '$'), LineEnding()))
|
||||
|
||||
" jump to it
|
||||
call s:godefJump(out, "")
|
||||
@ -31,15 +31,15 @@ endfunction
|
||||
function! go#def#JumpMode(mode)
|
||||
let arg = s:getOffset()
|
||||
|
||||
let bin_path = go#tool#BinPath(g:go_godef_bin)
|
||||
if empty(bin_path)
|
||||
return
|
||||
let bin_path = go#tool#BinPath(g:go_godef_bin)
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
|
||||
let command = bin_path . " -f=" . expand("%:p") . " -i " . shellescape(arg)
|
||||
|
||||
" get output of godef
|
||||
let out=system(command, join(getbufline(bufnr('%'), 1, '$'), "\n"))
|
||||
let out=system(command, join(getbufline(bufnr('%'), 1, '$'), LineEnding()))
|
||||
|
||||
call s:godefJump(out, a:mode)
|
||||
endfunction
|
||||
@ -51,7 +51,7 @@ function! s:getOffset()
|
||||
let offs = line2byte(pos[0]) + pos[1] - 2
|
||||
else
|
||||
let c = pos[1]
|
||||
let buf = line('.') == 1 ? "" : (join(getline(1, pos[0] - 1), "\n") . "\n")
|
||||
let buf = line('.') == 1 ? "" : (join(getline(1, pos[0] - 1), LineEnding()) . LineEnding())
|
||||
let buf .= c == 1 ? "" : getline(pos[0])[:c-2]
|
||||
let offs = len(iconv(buf, &encoding, "utf-8"))
|
||||
endif
|
||||
@ -66,7 +66,7 @@ function! s:godefJump(out, mode)
|
||||
let &errorformat = "%f:%l:%c"
|
||||
|
||||
if a:out =~ 'godef: '
|
||||
let out=substitute(a:out, '\n$', '', '')
|
||||
let out=substitute(a:out, LineEnding() . '$', '', '')
|
||||
echom out
|
||||
else
|
||||
let parts = split(a:out, ':')
|
||||
@ -85,7 +85,7 @@ function! s:godefJump(out, mode)
|
||||
let &switchbuf = "usetab"
|
||||
|
||||
if bufloaded(fileName) == 0
|
||||
tab split
|
||||
tab split
|
||||
endif
|
||||
else
|
||||
if a:mode == "split"
|
||||
@ -96,11 +96,10 @@ function! s:godefJump(out, mode)
|
||||
endif
|
||||
|
||||
" jump to file now
|
||||
ll 1
|
||||
sil ll 1
|
||||
normal zz
|
||||
|
||||
let &switchbuf = old_switchbuf
|
||||
end
|
||||
let &errorformat = old_errorformat
|
||||
endfunction
|
||||
|
||||
|
Reference in New Issue
Block a user