Skip to content

Commit

Permalink
Large changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainl committed May 4, 2015
1 parent 7170be3 commit 0bfa3cb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
20 changes: 10 additions & 10 deletions after/ftplugin/qf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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(<q-args>)
if exists("g:qf_mapping_filter")
execute "nnoremap <silent> <buffer> " . g:qf_mapping_filter . " :Filter <C-r><C-f><CR>"
else
nnoremap <silent> <buffer> § :Filter <C-r><C-f><CR>

nnoremap <silent> <Plug>QfFilter :Filter <C-r><C-f><CR>
if !hasmapto('<Plug>QfFilter')
nmap <buffer> § <Plug>QfFilter
endif

" restore the location/quickfix list
" usage:
" :Restore
command! -buffer Restore call qf#RestoreList()
if exists("g:qf_mapping_restore")
execute "nnoremap <silent> <buffer> " . g:qf_mapping_restore . " :Restore<CR>"
else
nnoremap <silent> <buffer> <F5> :Restore<CR>

nnoremap <silent> <Plug>QfRestore :Restore<CR>
if !hasmapto('<Plug>QfRestore')
nmap <buffer> <F5> <Plug>QfRestore
endif

" do something on each line in the location/quickfix list
Expand Down
47 changes: 23 additions & 24 deletions plugin/qf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,39 @@ let s:save_cpo = &cpo
set cpo&vim

" <Home> and <End> go up and down the quickfix list and wrap around
if exists("g:qf_mapping_cprevious")
execute "nnoremap <silent> " . g:qf_mapping_cprevious . " :call qf#WrapCommand('up', 'c')<CR>"
else
nnoremap <silent> <Home> :call qf#WrapCommand('up', 'c')<CR>
nnoremap <silent> <Plug>QfCprevious :call qf#WrapCommand('up', 'c')<CR>
nnoremap <silent> <Plug>QfCnext :call qf#WrapCommand('down', 'c')<CR>
" <C-Home> and <C-End> go up and down the location list and wrap around
nnoremap <silent> <Plug>QfLprevious :call qf#WrapCommand('down', 'l')<CR>
nnoremap <silent> <Plug>QfLnext :call qf#WrapCommand('up', 'l')<CR>
" jump to and from the location/quickfix window
nnoremap <expr> <silent> <Plug>QfSwitch &filetype == "qf" ? "<C-w>p" : "<C-w>b"
" default mappings
if !hasmapto('<Plug>QfCprevious')
nmap <Home> <Plug>QfCprevious
endif

if exists("g:qf_mapping_cnext")
execute "nnoremap <silent> " . g:qf_mapping_cnext . " :call qf#WrapCommand('down', 'c')<CR>"
else
nnoremap <silent> <End> :call qf#WrapCommand('down', 'c')<CR>
if !hasmapto('<Plug>QfCnext')
nmap <End> <Plug>QfCnext
endif

" <C-Home> and <C-End> go up and down the location list and wrap around
if exists("g:qf_mapping_lnext")
execute "nnoremap <silent> " . g:qf_mapping_lnext . " :call qf#WrapCommand('down', 'l')<CR>"
else
nnoremap <silent> <C-End> :call qf#WrapCommand('down', 'l')<CR>
if !hasmapto('<Plug>QfLprevious')
nmap <C-Home> <Plug>QfLprevious
endif

if exists("g:qf_mapping_lprevious")
execute "nnoremap <silent> " . g:qf_mapping_lprevious . " :call qf#WrapCommand('up', 'l')<CR>"
else
nnoremap <silent> <C-Home> :call qf#WrapCommand('up', 'l')<CR>
if !hasmapto('<Plug>QfLnext')
nmap <C-end> <Plug>QfLnext
endif

" jump to and from the quickfix window
if exists("g:qf_mapping_switch")
execute 'nnoremap <expr> ' . g:qf_mapping_switch . ' &filetype == "qf" ? "<C-w>p" : "<C-w>b"'
else
nnoremap <expr> ç &filetype == "qf" ? "<C-w>p" : "<C-w>b"
if !hasmapto('<Plug>QfSwitch')
nmap ç <Plug>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
Expand Down

0 comments on commit 0bfa3cb

Please sign in to comment.