From c38f69aebc35edde583a54442646eada27364255 Mon Sep 17 00:00:00 2001 From: Iain Patterson <me@iain.cx> Date: Mon, 14 Jan 2008 23:09:43 +0000 Subject: [PATCH] Cycle quickfix window with Qq. git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@94 6be0d1a5-5cfe-0310-89b6-964be062b18b --- .vimrc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR> vnoremap # y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR> @@ -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()<CR>:<CR> map Qt :Tlist<CR> " Change foldmethod with Qf. map Qf :se foldenable!<CR>:<CR> +" Toggle quickfix window with Qq. +map Qq :call Cycle_Quickfix()<CR>:<CR> endif -- 2.7.4