" toggle unite, quickfix list and location list if exists("g:loaded_toggle_list") finish endif let g:loaded_toggle_list = 1 " Inspired by " https://github.com/drmingdrmer/vim-toggle-quickfix/blob/master/autoload/togglequickfix.vim function! s:ToggleLocationList() let last = winnr('$') let cur = winnr() try lwindow 10 catch /E776/ echohl WarningMsg | echon 'No Location List' | echohl None endtry if winnr('$') == last lclose elseif winnr() != cur wincmd p endif endfunction function! s:ToggleQuickfixList() let last = winnr('$') let cur = winnr() cwindow 10 if winnr('$') == last cclose elseif winnr() != cur wincmd p endif endfunction function! s:ToggleUnite() for i in range(1, winnr('$')) let name = bufname(winbufnr(i)) if match(name, '^\[unite\]') == 0 UniteClose return endif endfor UniteResume endfunction nnoremap [oq :copen nnoremap ]oq :cclose nnoremap coq :call ToggleQuickfixList() nnoremap [ol :lopen nnoremap ]ol :lclose nnoremap col :call ToggleLocationList() nnoremap cop :pclose