Vim Tips Wiki
Advertisement
Tip 801 Printable Monobook Previous Next

created October 5, 2004 · complexity basic · author Jonas Lööf · version 5.7


I regularly use the quickfix window (see :help quickfix and :help :copen) to navigate compiler output. Working on a largish software system with multiple directories, 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:'). Additionally, zw opens 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


Advertisement