With inspiration and code from Ankit, I am using Vim to compile and run C++ programs without leaving the editor.
I added these two lines to my
nnoremap <F7> :!g++ -o %:r %<Enter> nnoremap <F8> :!./%:r<Enter>
F7 to compile the program I’m working on.
F8 runs that program.
This is much simpler than an IDE, and simpler still than Geany, which is pretty simple already.
These lines could be modified to compile and run a Java program, or to just run your code in scripting languages like Ruby, Perl and Python.
See Ankit’s post for his exact adds to
.vimrc, which are slightly different from what I ended up with.
And I want to thank him and all the others with similar tips and tutorials for opening my eyes to what you can do with Vim.