You should instead use the integrated :make/quickfix feature of vim. You'll
have a much better user experience.
First be sure that you have set javac as the make program. It's best done by
-> :runtime compiler/javac.vim
I would have done it in a java ftplugin, but as I'm not a Java developer, I'm
not sure this is a good default setting. So, let's put it in your function.
command! MakeAndRun :call s:CompileAndRunFolderJava()
function! s:CompileAndRunFolderJava() abort
" old trick to detect compilation errors - part 1
" --- The following code is borrowed from LaTeXSuite
" close the quickfix window before trying to open it again,
" otherwise whether or not we end up in the quickfix window
" after the :cwindow command is not fixed.
cclose " used to detect errors
let winnum = winnr()
" compile all java files in folder of the current buffer
" old trick to detect compilation errors - part 2
if winnum == winnr() " => no error detected
" run Main java file in that folder
:!(cd .. && java %:p:h:t.Main)
" delete all the .class files in that folder
" :echomsg "Done"
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.