Tip #351: Using quickfix in a different way
tip karma |
Rating 33/18, Viewed by 669
|
created: |
|
October 24, 2002 6:11 |
|
complexity: |
|
intermediate |
author: |
|
Karthick Gururaj |
|
as of Vim: |
|
6.0 |
I'm a software developer and I find vim's quickfix (:help quickfix) very helpful.
You can also use this while debugging your code, in a slightly different way...
Usually, you will have some print messages in your code, and after the program
runs, you'll look at the output to see the execution trace (e.g which if-constructs
were taken, how many times did a while loop iterate.. ). If you precede these
statements with a <filename>:<linenumber>, then, the program output can be parsed
with a :cfile, and the execution trace becomes very simple.
For instance, in C++
// fdebug is the pointer to the debug file called, debug.txt say.
#define DEBUG_MESG( ) fprintf(fdebug, "%0s:%0d\n", __FILE__, __LINE__)
...
function( )
{
...
if (something)
DEBUG_MESG( );
else
DEBUG_MESG( );
...
}
Open your code in vim and do a ":cfile debug.txt"
<<when 'formatoptions' has o easily enter a non commented line: go/gO mappings |
disabling cabbrev >>
Additional Notes
|