diff --git a/after/ftplugin/qf.vim b/after/ftplugin/qf.vim index 5b12e72..d0f1620 100644 --- a/after/ftplugin/qf.vim +++ b/after/ftplugin/qf.vim @@ -52,23 +52,23 @@ endif " filter the location/quickfix list " usage: " :Filter foo -" or: -" § with the cursor on a word command! -buffer -nargs=* Filter call qf#FilterList() -if exists("g:qf_mapping_filter") - execute "nnoremap " . g:qf_mapping_filter . " :Filter " -else - nnoremap § :Filter + +nnoremap QfFilter :Filter + +if !hasmapto('QfFilter') + nmap § QfFilter endif " restore the location/quickfix list " usage: " :Restore command! -buffer Restore call qf#RestoreList() -if exists("g:qf_mapping_restore") - execute "nnoremap " . g:qf_mapping_restore . " :Restore" -else - nnoremap :Restore + +nnoremap QfRestore :Restore + +if !hasmapto('QfRestore') + nmap QfRestore endif " do something on each line in the location/quickfix list diff --git a/plugin/qf.vim b/plugin/qf.vim index 40a3534..b4bb43b 100644 --- a/plugin/qf.vim +++ b/plugin/qf.vim @@ -14,40 +14,39 @@ let s:save_cpo = &cpo set cpo&vim " and go up and down the quickfix list and wrap around -if exists("g:qf_mapping_cprevious") - execute "nnoremap " . g:qf_mapping_cprevious . " :call qf#WrapCommand('up', 'c')" -else - nnoremap :call qf#WrapCommand('up', 'c') +nnoremap QfCprevious :call qf#WrapCommand('up', 'c') +nnoremap QfCnext :call qf#WrapCommand('down', 'c') + +" and go up and down the location list and wrap around +nnoremap QfLprevious :call qf#WrapCommand('down', 'l') +nnoremap QfLnext :call qf#WrapCommand('up', 'l') + +" jump to and from the location/quickfix window +nnoremap QfSwitch &filetype == "qf" ? "p" : "b" + +" default mappings +if !hasmapto('QfCprevious') + nmap QfCprevious endif -if exists("g:qf_mapping_cnext") - execute "nnoremap " . g:qf_mapping_cnext . " :call qf#WrapCommand('down', 'c')" -else - nnoremap :call qf#WrapCommand('down', 'c') +if !hasmapto('QfCnext') + nmap QfCnext endif -" and go up and down the location list and wrap around -if exists("g:qf_mapping_lnext") - execute "nnoremap " . g:qf_mapping_lnext . " :call qf#WrapCommand('down', 'l')" -else - nnoremap :call qf#WrapCommand('down', 'l') +if !hasmapto('QfLprevious') + nmap QfLprevious endif -if exists("g:qf_mapping_lprevious") - execute "nnoremap " . g:qf_mapping_lprevious . " :call qf#WrapCommand('up', 'l')" -else - nnoremap :call qf#WrapCommand('up', 'l') +if !hasmapto('QfLnext') + nmap QfLnext endif -" jump to and from the quickfix window -if exists("g:qf_mapping_switch") - execute 'nnoremap ' . g:qf_mapping_switch . ' &filetype == "qf" ? "p" : "b"' -else - nnoremap ç &filetype == "qf" ? "p" : "b" +if !hasmapto('QfSwitch') + nmap ç QfSwitch endif -" automatically open the quickfix/location window after :make, :grep, -" :lvimgrep and friends if there are valid errors/locations +" automatically open the location/quickfix window after :make, :grep, +" :lvimgrep and friends if there are valid locations/errors augroup qf autocmd! autocmd QuickFixCmdPost grep,make,grepadd,vimgrep,vimgrepadd,cscope,cfile,cgetfile,caddfile,helpgrep cwindow