From 91fdc789a6a306af953f184a702c1e84b46dc942 Mon Sep 17 00:00:00 2001 From: Tony Duckles Date: Sat, 23 Mar 2019 14:32:52 -0500 Subject: [PATCH] .vimrc: Add quickfix window toggle helper --- .vimrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.vimrc b/.vimrc index 4355e85..63c6ccb 100644 --- a/.vimrc +++ b/.vimrc @@ -385,6 +385,16 @@ nmap gc :Gcommit nmap gp :Gpush " cd to the directory containing the file in the buffer nmap cd :lcd %:h +" toggle quickfix window +function! QuickfixToggle() + let wcnt_old = winnr("$") + cwindow + let wcnt_cur = winnr("$") + if wcnt_old == wcnt_cur + cclose + endif +endfunction +nmap cc :call QuickfixToggle() " toggle diffmode for a buffer function! DiffToggle() if &diff -- 2.45.2