misc/vim: intro NitExecute to interpret the current file with `nit`
[nit.git] / misc / vim / plugin / nit.vim
index bb8dd13..6824882 100644 (file)
@@ -53,7 +53,7 @@ function NitComplete()
                let g:acp_behaviorKeywordIgnores = ['new', 'var', 'in', 'do', 'els', 'end', 'ret', 'for', 'fun']
 
                " Use nitls to compute all interesting files from the current directory and the standard library
-               for file in split(system('nitls -M standard .', '\n'))
+               for file in split(system('nitls -M core .', '\n'))
                        silent let &complete = &complete . ',s' . file
                        silent set complete?
                endfor
@@ -382,6 +382,19 @@ fun NitGitGrep()
        redraw!
 endfun
 
+" Call `nit` on the current file
+fun NitExecute()
+       let path = expand('%')
+
+       if &modified
+               let path = tempname() . '.nit'
+               execute '%write '. path
+       endif
+
+       execute '!nit "' . path . '"'
+endfun
+command NitExecute call NitExecute()
+
 if !exists("g:nit_disable_omnifunc") || !g:nit_disable_omnifunc
        " Activate the omnifunc on Nit files
        autocmd FileType nit set omnifunc=NitOmnifunc