X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.vimrc;h=1017617b85d7c823bba0e14ee1ba104dbf423b51;hb=2da9ea6da645cdb26ca23d12f7f52c60351f3a4c;hp=9e004de420e9fb0b8b10fa50e090586ed2a4d4f1;hpb=bcbfee8ff8bf115ace00870560f1a2240d612413;p=profile.git 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