Vim Tips Wiki
(Added to Folding and Compiler Categories)
m (Folding of (gnu)make output moved to Folding of gnu make output: Page moved by JohnBot to improve title)

Revision as of 09:56, 18 October 2007

Previous TipNext Tip

Tip: #801 - Fold quickfix list on directory or file names

Created: October 5, 2004 8:37 Complexity: basic Author: Jonas L��f Version: 5.7 Karma: 15/6 Imported from: Tip#801

I regularly use the compiler output window of the QuickFix feature (see :help quickfix and :help :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 

Comments