Last active
December 14, 2015 22:09
-
-
Save dgryski/5156158 to your computer and use it in GitHub Desktop.
vim plugin for godef
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" needs https://code.google.com/p/rog-go/source/browse/exp/cmd/godef/godef.go | |
if !exists("g:godef_command") | |
let g:godef_command = "godef" | |
endif | |
function! GodefUnderCursor() | |
let offs=line2byte(line('.'))+col('.')-1 | |
call Godef("-o=" . offs) | |
endfunction | |
function! Godef(arg) | |
let out=system(g:godef_command . " -f=" . bufname("%") . " " . a:arg) | |
if out =~ 'godef: ' | |
let out=substitute(out, '\n$', '', '') | |
echom out | |
else | |
split | |
lexpr out | |
end | |
endfunction | |
nnoremap <buffer> gd :call GodefUnderCursor()<cr> | |
command! -range -nargs=1 Godef :call Godef(<q-args>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've moved this to my actual github page: https://github.com/dgryski/vim-godef/
New development, if any, will happen there.