I am getting ready to write lot of small experimental java programs as I am studying for java 开发者_Python百科certification. Since I want to avoid using an IDE I'm giving gvim a try.
I have a HelloWorld.java file open. How can I run javac
and then java
and then be able to see the output all in one window?
I do not want to alt tab to a dos prompt window. compile/run the program there and then come back to my editor.
Try this in command mode:
:!javac HelloWorld.java && java HelloWorld
Edit: I believe that in windows do concatenate multiple commands you use &&
and not ;
as I posted previously. But I'm not sure if this applies to gvim.
You can run external programs from vim by prefixing the command you want to run with "!". For example you could run javac straight from gvim by typing ":!javac filename"
精彩评论