*quickfix.txt* For Vim version 7.3. Last change: 2011 May 10
VIM REFERENCE MANUAL by Bram Moolenaar
This subject is introduced in section |30.1| of the user manual.
1. Using QuickFix commands |quickfix|
2. The error window |quickfix-window|
3. Using more than one list of errors |quickfix-error-lists|
4. Using :make |:make_makeprg|
5. Using :grep |grep|
6. Selecting a compiler |compiler-select|
7. The error format |error-file-format|
8. The directory stack |quickfix-directory-stack|
9. Specific error file formats |errorformats|
{Vi does not have any of these commands}
The quickfix commands are not available when the |+quickfix| feature was
disabled at compile time.
=============================================================================
1. Using QuickFix commands *quickfix* *Quickfix* *E42*
Vim has a special mode to speedup the edit-compile-edit cycle. This is
inspired by the quickfix option of the Manx's Aztec C compiler on the Amiga.
The idea is to save the error messages from the compiler in a file and use Vim
to jump to the errors one by one. You can examine each problem and fix it,
without having to remember all the error messages.
In Vim the quickfix commands are used more generally to find a list of
positions in files. For example, |:vimgrep| finds pattern matches. You can
use the positions in a script with the |getqflist()| function. Thus you can
do a lot more than the edit/compile/fix cycle!
If you are using Manx's Aztec C compiler on the Amiga look here for how to use
it with Vim: |quickfix-manx|. If you are using another compiler you should
save the error messages in a file and start Vim with "vim -q filename". An
easy way to do this is with the |:make| command (see below). The
'errorformat' option should be set to match the error messages from your
compiler (see |errorformat| below).
*location-list* *E776*
A location list is similar to a quickfix list and contains a list of positions
in files. A location list is associated with a window and each window can
have a separate location list. A location list can be associated with only
one window. The location list is independent of the quickfix list.
When a window with a location list is split, the new window gets a copy of the
location list. When there are no references to a location list, the location
list is destroyed.
The following quickfix commands can be used. The location list commands are
similar to the quickfix commands, replacing the 'c' prefix in the quickfix
command with 'l'.
*:cc*
:cc[!] [nr] Display error [nr]. If [nr] is omitted, the same
error is displayed again. Without [!] this doesn't
work when jumping to another buffer, the current buffer
has been changed, there is the only window for the
buffer and both 'hidden' and 'autowrite' are off.
When jumping to another buffer with [!] any changes to
the current buffer are lost, unless 'hidden' is set or
there is another window for this buffer.
The 'switchbuf' settings are respected when jumping
to a buffer.
*:ll*
:ll[!] [nr] Same as ":cc", except the location list for the
current window is used instead of the quickfix list.
*:cn* *:cnext* *E553*
:[count]cn[ext][!] Display the [count] next error in the list that
includes a file name. If there are no file names at
all, go to the [count] next error. See |:cc| for
[!] and 'switchbuf'.
*:lne* *:lnext*
:[count]lne[xt][!] Same as ":cnext", except the location list for the
current window is used instead of the quickfix list.
:[count]cN[ext][!] *:cp* *:cprevious* *:cN* *:cNext*
:[count]cp[revious][!] Display the [count] previous error in the list that
includes a file name. If there are no file names at
all, go to the [count] previous error. See |:cc| for
[!] and 'switchbuf'.
:[count]lN[ext][!] *:lp* *:lprevious* *:lN* *:lNext*
:[count]lp[revious][!] Same as ":cNext" and ":cprevious", except the location
list for the current window is used instead of the
quickfix list.
*:cnf* *:cnfile*
:[count]cnf[ile][!] Display the first error in the [count] next file in
the list that includes a file name. If there are no
file names at all or if there is no next file, go to
the [count] next error. See |:cc| for [!] and
'switchbuf'.
*:lnf* *:lnfile*
:[count]lnf[ile][!] Same as ":cnfile", except the location list for the
current window is used instead of the quickfix list.
:[count]cNf[ile][!] *:cpf* *:cpfile* *:cNf* *:cNfile*
:[count]cpf[ile][!] Display the last error in the [count] previous file in
the list that includes a file name. If there are no
file names at all or if there is no next file, go to
the [count] previous error. See |:cc| for [!] and
'switchbuf'.
:[count]lNf[ile][!] *:lpf* *:lpfile* *:lNf* *:lNfile*
:[count]lpf[ile][!] Same as ":cNfile" and ":cpfile", except the location
list for the current window is used instead of the
quickfix list.
*:crewind* *:cr*
:cr[ewind][!] [nr] Display error [nr]. If [nr] is omitted, the FIRST
error is displayed. See |:cc|.
*:lrewind* *:lr*
:lr[ewind][!] [nr] Same as ":crewind", except the location list for the
current window is used instead of the quickfix list.
*:cfirst* *:cfir*
:cfir[st][!] [nr] Same as ":crewind".
*:lfirst* *:lfir*
:lfir[st][!] [nr] Same as ":lrewind".
*:clast* *:cla*
:cla[st][!] [nr] Display error [nr]. If [nr] is omitted, the LAST
error is displayed. See |:cc|.
*:llast* *:lla*
:lla[st][!] [nr] Same as ":clast", except the location list for the
current window is used instead of the quickfix list.
*:cq* *:cquit*
:cq[uit][!] Quit Vim with an error code, so that the compiler
will not compile the same file again.
WARNING: All changes in files are lost! Also when the
[!] is not use