Vim Tips Wiki
(Change to TipImported template + severe manual clean)
(Move categories to tip template)
Line 9: Line 9:
 
|version=6.0
 
|version=6.0
 
|rating=46/15
 
|rating=46/15
  +
|category1=Compiler
  +
|category2=
 
}}
 
}}
 
Uptil vim 5.8, I was using the cfile, clist etc for quickfix mode.
 
Uptil vim 5.8, I was using the cfile, clist etc for quickfix mode.
Line 46: Line 48:
   
 
----
 
----
[[Category:Compiler]]
 

Revision as of 01:32, 25 April 2008

Tip 458 Printable Monobook Previous Next

created April 20, 2003 · complexity intermediate · author Omanakuttan · version 6.0


Uptil vim 5.8, I was using the cfile, clist etc for quickfix mode.

In vim6.x, I found out that :cw will boost my productivity as a programmer.

To make, type :make as we do in older versions of vim (<6.0).

Instead of clist, cfile, etc., type

:cw<enter>

you get one split window, in which errors are listsed. Current error line will be highlighted and cursor will move to the corresponding source file line.

Doing an <enter> on any error line in the error window will take the cursor to the corresponding source line.

This eliminates the need for the process described in VimTip345.(Now you can get rid of Visual studio altogether !)

References

Comments

I guess I should say what works for me for compiling Java programs on MS Windows. It can be improved, but I am not sure how. I put the following in _vimrc.

set makeprg=javac
set makeef=c:\dev\src\errors.txt
set shellpipe=2>
set errorformat=%A%f:%l:\ %m,%C%m
noremap <M-1> :w<Enter>:set ch=5<Enter>:make -d C:\\dev\\classes %:p<Enter>
noremap <M-2> :cp<Enter>
noremap <M-3> :cn<Enter>
noremap <M-4> :cl<Enter>

Press Alt-1 to compile the current file. Alt-2 and Alt-3 move the cursor in the source code to previous and next errors. (I have another command to reset the command line height when I'm done looking at errors.)

Problem: it removes spaces so the caret that javac uses to point to the error location is wrong. I have tried all kinds of different formats. If someone does not know a better error format for javac, I just discoved that :set shellpipe= will open DOS window with all the spaces preserved.