1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2015-01-18 12:58:28 +00:00
parent c3ba0f3c06
commit e7a01094b6
274 changed files with 4547 additions and 3075 deletions

View File

@ -35,7 +35,7 @@ function! s:godocWord(args)
if !executable('godoc')
echohl WarningMsg
echo "godoc command not found."
echo " install with: go get code.google.com/p/go.tools/cmd/godoc"
echo " install with: go get golang.org/x/tools/cmd/godoc"
echohl None
return []
endif
@ -51,7 +51,7 @@ function! s:godocWord(args)
let words = a:args
endif
if !len(words)
if !len(words)
return []
endif
@ -85,7 +85,7 @@ function! go#doc#OpenBrowser(...)
call go#tool#OpenBrowser(godoc_url)
endfunction
function! go#doc#Open(mode, ...)
function! go#doc#Open(newmode, mode, ...)
let pkgs = s:godocWord(a:000)
if empty(pkgs)
return
@ -102,10 +102,14 @@ function! go#doc#Open(mode, ...)
return -1
endif
call s:GodocView(a:mode, content)
call s:GodocView(a:newmode, a:mode, content)
if exported_name == ''
silent! normal gg
return -1
endif
" jump to the specified name
if search('^func ' . exported_name . '(')
silent! normal zt
return -1
@ -125,11 +129,11 @@ function! go#doc#Open(mode, ...)
silent! normal gg
endfunction
function! s:GodocView(position, content)
function! s:GodocView(newposition, position, content)
" reuse existing buffer window if it exists otherwise create a new one
if !bufexists(s:buf_nr)
execute a:position
file `="[Godoc]"`
execute a:newposition
sil file `="[Godoc]"`
let s:buf_nr = bufnr('%')
elseif bufwinnr(s:buf_nr) == -1
execute a:position
@ -149,9 +153,9 @@ function! s:GodocView(position, content)
setlocal iskeyword-=-
setlocal modifiable
%delete _
%delete _
call append(0, split(a:content, "\n"))
$delete _
sil $delete _
setlocal nomodifiable
endfunction