From 2965fa15a189549df3d87441cbc49fd99ff4943b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Sat, 11 Apr 2015 09:41:21 -0400 Subject: [PATCH] misc/vim: make Nitdoc a command MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use this vim command to show the doc of any entities `:Nitdoc Object`. Signed-off-by: Alexis Laferrière --- misc/vim/plugin/nit.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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') -- 1.7.9.5