From: Iain Patterson Date: Mon, 14 Jan 2008 23:09:43 +0000 (+0000) Subject: Cycle quickfix window with Qq. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=c38f69aebc35edde583a54442646eada27364255;p=profile.git Cycle quickfix window with Qq. git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@94 6be0d1a5-5cfe-0310-89b6-964be062b18b --- diff --git a/.vimrc b/.vimrc index 9e004de..1017617 100644 --- a/.vimrc +++ b/.vimrc @@ -227,6 +227,9 @@ endif if version >= "600" version 6.0 +" Remember quickfix state. +let g:quickfixing=0 + " Set indenting by filetype. filetype indent on @@ -256,6 +259,10 @@ highlight StatusLine guifg=white guibg=blue ctermbg=white ctermfg=blue " Numbers in blue. highlight LineNr term=underline cterm=bold guifg=blue ctermfg=blue +" Remember that we are opening the quickfix window. +au BufWinEnter quickfix let g:quickfixing=1 +au BufUnload * if &ft == "qf" | let g:quickfixing=0 | endif + " Make * and # work the way you expect in visual mode. vnoremap * y/\V=substitute(escape(@@,"/\\"),"\n","\\\\n","ge") vnoremap # y?\V=substitute(escape(@@,"?\\"),"\n","\\\\n","ge") @@ -293,6 +300,16 @@ fun! Cycle_VerboseStatusLine() call Show_StatusLine() endfun +" Toggle quickfix window. +fun! Cycle_Quickfix() + if g:quickfixing == 1 + cclose + let g:quickfixing=0 + else + copen + endif +endfun + " We use Q for various commands. Unmap it. " Vim 5 won't let us unmap this as it treats Q as an ambiguous mapping (because " Qx also exists. With Vim 5 you are rewarded with Ex mode if you don't type @@ -309,6 +326,8 @@ map Ql :call Cycle_List(): map Qt :Tlist " Change foldmethod with Qf. map Qf :se foldenable!: +" Toggle quickfix window with Qq. +map Qq :call Cycle_Quickfix(): endif