sponsor Vim development Vim logo Vim Book Ad

QuickFixCurrentNumber : Locate the quickfix item at the cursor position.

 script karma  Rating 1/1, Downloaded by 175    Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
script type
You can navigate through the errors in the quickfix list with the built-in
:cfirst, :cnext, etc. commands. The quickfix and location lists have a
notion of "current item" (the highlighted one), and you can easily jump back
to it or others. But there's no built-in way to find out which error is at or
after the current cursor position, and you cannot limit the navigation to
errors in the current buffer.

This plugin provides additional quickfix commands like :Cnr and :Cgo to
print / go to the item at or after the cursor position, and motions like ]q
to go to previous / next errors in the current buffer, based on the cursor

Inspired by the following Stack Overflow question:

:Cnr, :Lnr              Print the number of the item in the quickfix /
                        location list for the current cursor position (or the
                        next item after the cursor).

:Cgo, :Lgo, g<C-Q>      Go to the item in the quickfix / location list for the
                        current cursor position (or the next item after the

[q / ]q                 Go to [count] previous / next start of an error in the
                        current buffer.
g[q / g]q               Go to [count] first / last error in the current

[l / ]l                 Go to [count] previous / next start of a location list
                        item in the current buffer.
g[l / g]l               Go to [count] first / last location list item in the
                        current buffer.
install details
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
    vim QuickFixCurrentNumber*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.000 or

For a permanent configuration, put the following commands into your vimrc:

If you want to use different mappings, map your keys to the
<Plug>(QuickFixCurrentNumber...) mapping targets _before_ sourcing the script
(e.g. in your vimrc):
    nmap g<C-q> <Plug>(QuickFixCurrentNumberGo)
    nmap ]q     <Plug>(QuickFixCurrentNumberQNext)
    nmap [q     <Plug>(QuickFixCurrentNumberQPrev)
    nmap ]l     <Plug>(QuickFixCurrentNumberLNext)
    nmap [l     <Plug>(QuickFixCurrentNumberLPrev)
    nmap g[q    <Plug>(QuickFixCurrentNumberQFirst)
    nmap g]q    <Plug>(QuickFixCurrentNumberQLast)
    nmap g[l    <Plug>(QuickFixCurrentNumberLFirst)
    nmap g]l    <Plug>(QuickFixCurrentNumberLLast)

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
QuickFixCurrentNumber-1.00.vmb.gz 1.00 2013-02-19 7.0 Ingo Karkat Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo