VIM - Vi IMproved  -  Compiling with Vim

[ Home - Syntax Files - Rxvt - Dead Keys - Compiling - Ispell - Download ]

For some reason I never run make from inside vim. However, I have written a short script that executes make and calls vim if there was an error. If you are interested you can download it here. A sample session:

% make
javac Article.java
Article.java:8: Class bolean not found in type declaration.
        bolean changed=false;
                      ^
Article.java:8: Incompatible type for boolean. Can't convert boolean to bolean.
        bolean changed=false;
                       ^
Article.java:32: Incompatible type for if. Can't convert bolean to boolean.
                if(changed) {
                ^
Article.java:38: Incompatible type for =. Can't convert boolean to bolean.
                        changed=false;
                               ^
Article.java:76: Incompatible type for =. Can't convert boolean to bolean.
                changed=true;
                       ^
5 errors
gmake: *** [Article.class] Error 1
start editing ?                                      

By answering with 'y' vim is started, opens the correct file and positions the cursor at the correct line. As many error messages are longer than one line I use a special startup file which reserves 5 lines for the error messages and redefines 4 keys for easier navigation, namely:

 CTRL-N: Jump to the next error
 CTRL-P: Jump to the previous error
 CTRL-V: Redisplay the current error message
 CTRL-L: Display all error messages

This script is able to cope with nested makefiles, as long as makefiles in subdirectories are called via make -C subdirectory (like for example in the linux kernel).

(C) 1997-2001 Claudio Fleiner