nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
misc/vim: intro NitExecute to interpret the current file with `nit`
[nit.git]
/
misc
/
vim
/
plugin
/
nit.vim
diff --git
a/misc/vim/plugin/nit.vim
b/misc/vim/plugin/nit.vim
index
363a8f9
..
6824882
100644
(file)
--- a/
misc/vim/plugin/nit.vim
+++ b/
misc/vim/plugin/nit.vim
@@
-382,6
+382,19
@@
fun NitGitGrep()
redraw!
endfun
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
if !exists("g:nit_disable_omnifunc") || !g:nit_disable_omnifunc
" Activate the omnifunc on Nit files
autocmd FileType nit set omnifunc=NitOmnifunc