From: Alexis Laferrière Date: Sat, 11 Apr 2015 13:41:21 +0000 (-0400) Subject: misc/vim: make Nitdoc a command X-Git-Tag: v0.7.4~30^2~4 X-Git-Url: http://nitlanguage.org misc/vim: make Nitdoc a command Use this vim command to show the doc of any entities `:Nitdoc Object`. Signed-off-by: Alexis Laferrière --- diff --git a/misc/vim/plugin/nit.vim b/misc/vim/plugin/nit.vim index 073ef8b..9968b5e 100644 --- a/misc/vim/plugin/nit.vim +++ b/misc/vim/plugin/nit.vim @@ -266,9 +266,13 @@ fun NitOmnifunc(findstart, base) endfun " Show doc for the entity under the cursor in the preview window -fun Nitdoc() - " Word under cursor - let word = expand("") +fun Nitdoc(...) + if a:0 == 0 || empty(a:1) + " Word under cursor + let word = expand("") + else + let word = join(a:000, ' ') + endif " All possible docs (there may be more than one entity with the same name) let docs = [] @@ -351,4 +355,7 @@ endfun " Activate the omnifunc on Nit files autocmd FileType nit set omnifunc=NitOmnifunc +" Define the user command Nitdoc for ease of use +command -nargs=* Nitdoc call Nitdoc("") + let s:script_dir = fnamemodify(resolve(expand(':p')), ':h')