misc/vim: add option to disable omnifunc
[nit.git] / misc / vim / plugin / nit.vim
index 2fe79d0..bb8dd13 100644 (file)
@@ -318,6 +318,7 @@ fun Nitdoc(...)
 
        " Found no doc, give up
        if empty(docs) || !(join(docs, '') =~ '\w')
+               echo 'Nitdoc found nothing for "' . word . '"'
                return
        endif
 
@@ -334,6 +335,8 @@ fun Nitdoc(...)
                        silent put = ''
                endif
        endfor
+       execute 0
+       delete " the first empty line
 
        " Set options
        setlocal buftype=nofile
@@ -379,8 +382,10 @@ fun NitGitGrep()
        redraw!
 endfun
 
-" Activate the omnifunc on Nit files
-autocmd FileType nit set omnifunc=NitOmnifunc
+if !exists("g:nit_disable_omnifunc") || !g:nit_disable_omnifunc
+       " Activate the omnifunc on Nit files
+       autocmd FileType nit set omnifunc=NitOmnifunc
+endif
 
 " Define the user command Nitdoc for ease of use
 command -nargs=* Nitdoc call Nitdoc("<args>")