Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements #89, one shortcut to up/down on quickfix or location list #90

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions autoload/qf/wrap.vim
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@ function! qf#wrap#WrapCommand(direction, prefix)
endif
endfunction

" Navigates in quick fix window to next/prev entry if quckfix is opened,
" otherwise navigates up/down in location list.
function! qf#wrap#WrapCommandQfOrLoc(direction)
if qf#IsQfWindowOpen()
call qf#wrap#WrapCommand(a:direction, 'c')
else
call qf#wrap#WrapCommand(a:direction, 'l')
endif
endfunction

let &cpo = s:save_cpo
16 changes: 16 additions & 0 deletions doc/qf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ Global mappings:
<Plug>(qf_qf_next) ......................... |<Plug>(qf_qf_next)|
<Plug>(qf_loc_previous) .................... |<Plug>(qf_loc_previous)|
<Plug>(qf_loc_next) ........................ |<Plug>(qf_loc_next)|
<Plug>(qf_qf_or_loc_previous) .............. |<Plug>(qf_qf_or_loc_previous)|
<Plug>(qf_qf_or_loc_next) .................. |<Plug>(qf_qf_or_loc_next)|
<Plug>(qf_qf_switch) ....................... |<Plug>(qf_qf_switch)|
<Plug>(qf_qf_toggle) ....................... |<Plug>(qf_qf_toggle)|
<Plug>(qf_qf_toggle_stay) .................. |<Plug>(qf_qf_toggle_stay)|
Expand Down Expand Up @@ -156,6 +158,20 @@ Example: >
nmap <C-Home> <Plug>(qf_loc_previous)
nmap <C-End> <Plug>(qf_loc_next)
<
------------------------------------------------------------------------------
*<Plug>(qf_qf_or_loc_previous)*
*<Plug>(qf_qf_or_loc_next)*
Scope: global ~
Default: none ~

Go up and down the quick quickfix list if one is opened. Othewise go up and
down in the current location list. In both cases it makes wrap around.

Example: >

nmap <S-Home> <Plug>(qf_qf_or_loc_previous)
nmap <S-End> <Plug>(qf_qf_or_loc_next)

------------------------------------------------------------------------------
*<Plug>(qf_qf_switch)*
Scope: global ~
Expand Down
5 changes: 5 additions & 0 deletions plugin/qf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ nnoremap <silent> <Plug>(qf_qf_next) :<C-u> call qf#wrap#WrapComm
nnoremap <silent> <Plug>(qf_loc_previous) :<C-u> call qf#wrap#WrapCommand('up', 'l')<CR>
nnoremap <silent> <Plug>(qf_loc_next) :<C-u> call qf#wrap#WrapCommand('down', 'l')<CR>


" Go up and down quickfix or location list
nnoremap <silent> <Plug>(qf_qf_or_loc_previous) :<C-u> call qf#wrap#WrapCommandQfOrLoc('up')<CR>
nnoremap <silent> <Plug>(qf_qf_or_loc_next) :<C-u> call qf#wrap#WrapCommandQfOrLoc('down')<CR>

" Toggle quickfix list
nnoremap <silent> <Plug>(qf_qf_toggle) :<C-u> call qf#toggle#ToggleQfWindow(0)<CR>
nnoremap <silent> <Plug>(qf_qf_toggle_stay) :<C-u> call qf#toggle#ToggleQfWindow(1)<CR>
Expand Down