sponsor Vim development Vim logo Vim Book Ad

basic Tip #801: Folding of (gnu)make output

 tip karma   Rating 10/4, Viewed by 294 

created:   October 5, 2004 8:37      complexity:   basic
author:   Jonas Lööf      as of Vim:   5.7

I regularly use the compiler output window of the QuickFix feature (see help on 'quickfix' and 'copen') to navigate the compiler output. Working on a largish software system with multiple directories with subdirectories in them, the list can get quite long. I use the following entries in my .vimrc to automatically fold on each subdirectory, and open folds containing errors (the string 'error:'). Aditionally 'zw' open also the folds containing the string 'warning:', while 'zq' switches back to the original.

"Folding of (gnu)make output
au BufReadPost quickfix setlocal foldmethod=marker
au BufReadPost quickfix setlocal foldmarker=Entering\ directory,Leaving\ directory
au BufReadPost quickfix map <buffer> <silent> zq zM:g/error:/normal zv<cr>
au BufReadPost quickfix map <buffer> <silent> zw zq:g/warning:/normal zv<cr>
au BufReadPost quickfix normal zq

 rate this tip  Life Changing Helpful Unfulfilling 

<<Sorting lines in a file based on the number of words in each line | Specify what you do not want to have in a search and other helpful searches. >>

Additional Notes

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge Logo