nvim-nim/autoload/features/info.vim
baabelfish dc2615545a Outline
2016-02-04 02:58:03 +02:00

58 lines
1.3 KiB
VimL

if exists("s:loaded")
finish
endif
let s:loaded = 1
let s:InfoImpl = {}
function! s:New(useWeb)
let result = copy(s:InfoImpl)
let result.useWeb = a:useWeb
return result
endfunction
function! s:InfoImpl.run(data)
if len(a:data.lines) == 0
echo "No information found"
return
endif
let res = util#ParseV1(a:data.lines[0])
if self.useWeb
call util#open_module_doc(res.location, res.lname)
else
echohl None
echohl Function | echon res.lname
echohl Comment | echon "\n » "
echohl Type | echon res.kindstr
if len(res.name) > 0 && res.lname != res.name
echon "\n"
echohl Comment | echon " » "
echohl Typedef | echon res.name
end
echohl Comment | echon "\n » "
echohl Include | echon res.location
echohl Comment | echon " ("
echohl String | echon res.file
echohl Comment | echon ")"
if res.doc != "\"\""
echohl Comment | echon "\n » "
echohl Normal | echon res.doc
endif
endif
endfunction
function! features#info#web()
call suggest#New("def", 1, 0, s:New(1))
endfunction
function! features#info#run()
call suggest#New("def", 1, 0, s:New(0))
endfunction