" Quickfix - Modeline and Notes {{{ " vim: set sw=2 ts=2 sts=2 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell: " " cinaeco/dotfiles Quickfix Maps and Behaviors " " Some personal conventions: " - 'q' to close quickfix and location list windows. " - 'o' to open quickfix and location list entries. " (not all plugins have these maps) " - and for previous and next entries, so long as quickfix " is open. " (maps are cleared when quickfix is closed) " - quickfix should open after any grep invocation e.g. :Glog " (particularly for fugitive - tpope refuses this as default behaviour) " " TODO: " Perhaps this could be some less arbitrary rule? " " }}} if has("autocmd") " Quickfix Buffer remaps, 'q' and 'o'. {{{ " - `q` to close qf buffer. " - `o` to open location entry under cursor. autocmd FileType qf nnoremap q :ccl:lcl autocmd FileType qf nnoremap o " }}} " Global maps on qf window open, '' and ''. {{{ " - `` and `` for going to previous and next entry " - unmaps when qf buffer is closed. autocmd BufWinEnter quickfix \ setlocal nocursorline | \ let g:qfix_win = bufnr("$") | \ call MapQfPrevNext() " }}} " Global map removal on qf window close. {{{ autocmd BufWinLeave * \ if exists("g:qfix_win") && expand("") == g:qfix_win | \ unlet! g:qfix_win | \ call UnmapQfPrefNext() | \ endif " }}} " Open quickfix window after any grep invocation (Glog and Ggrep). {{{ autocmd QuickFixCmdPost *grep* cwindow | \ setlocal nocursorline | \ let g:qfix_win = bufnr("$") | \ call MapQfPrevNext() " }}} " and map adding helper. {{{ function! MapQfPrevNext() execute "nmap :cprev" execute "nmap :cnext" endfunction " }}} " and map removal helper. {{{ function! UnmapQfPrefNext() execute "nunmap " execute "nunmap " endfunction " }}} endif