代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>quickfix - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>
<body>
<header>
<div class="header">
<a href="http://vim-jp.org/">vim-jp</a>
/ <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
/ quickfix<br />
<a name="top"></a><h1>quickfix - Vim Documentation</h1>
<a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
</div>
</header>
<nav>
<dl>
<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>
<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>
<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>
<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>
<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>
<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>
<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>
<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>
<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>
<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>
<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>
<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>
<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>
<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>
<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>
<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>
<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>
</dl>
</nav>
<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="quickfix.html" name="quickfix.txt">quickfix.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2017 Jun 13<br>
<br>
<br>
<span class="Identifier">VIM REFERENCE MANUAL by Bram Moolenaar</span><br>
<br>
<br>
This subject is introduced in section <a class="Identifier" href="usr_30.html#30.1">30.1</a> of the user manual.<br>
<br>
1. Using QuickFix commands <a class="Identifier" href="quickfix.html#quickfix">quickfix</a><br>
2. The error window <a class="Identifier" href="quickfix.html#quickfix-window">quickfix-window</a><br>
3. Using more than one list of errors <a class="Identifier" href="quickfix.html#quickfix-error-lists">quickfix-error-lists</a><br>
4. Using :make <a class="Identifier" href="quickfix.html#:make_makeprg">:make_makeprg</a><br>
5. Using :grep <a class="Identifier" href="quickfix.html#grep">grep</a><br>
6. Selecting a compiler <a class="Identifier" href="quickfix.html#compiler-select">compiler-select</a><br>
7. The error format <a class="Identifier" href="quickfix.html#error-file-format">error-file-format</a><br>
8. The directory stack <a class="Identifier" href="quickfix.html#quickfix-directory-stack">quickfix-directory-stack</a><br>
9. Specific error file formats <a class="Identifier" href="quickfix.html#errorformats">errorformats</a><br>
<br>
<span class="Special">{Vi does not have any of these commands}</span><br>
<br>
The quickfix commands are not available when the <a class="Identifier" href="various.html#+quickfix">+quickfix</a> feature was<br>
disabled at compile time.<br>
<br>
<span class="PreProc">=============================================================================</span><br>
1. Using QuickFix commands <a class="Constant" href="quickfix.html#quickfix" name="quickfix">quickfix</a> <a class="Constant" href="quickfix.html#Quickfix" name="Quickfix">Quickfix</a> <a class="Constant" href="quickfix.html#E42" name="E42">E42</a><br>
<br>
Vim has a special mode to speedup the edit-compile-edit cycle. This is<br>
inspired by the quickfix option of the Manx's Aztec C compiler on the Amiga.<br>
The idea is to save the error messages from the compiler in a file and use Vim<br>
to jump to the errors one by one. You can examine each problem and fix it,<br>
without having to remember all the error messages.<br>
<br>
In Vim the quickfix commands are used more generally to find a list of<br>
positions in files. For example, <a class="Identifier" href="quickfix.html#:vimgrep">:vimgrep</a> finds pattern matches. You can<br>
use the positions in a script with the <a class="Identifier" href="eval.html#getqflist()">getqflist()</a> function. Thus you can<br>
do a lot more than the edit/compile/fix cycle!<br>
<br>
If you have the error messages in a file you can start Vim with:<br>
<div class="helpExample"> vim -q filename</div>
<br>
From inside Vim an easy way to run a command and handle the output is with the<br>
<a class="Identifier" href="quickfix.html#:make">:make</a> command (see below).<br>
<br>
The <a class="Type" href="options.html#'errorformat'">'errorformat'</a> option should be set to match the error messages from your<br>
compiler (see <a class="Identifier" href="quickfix.html#errorformat">errorformat</a> below).<br>
<br>
<a class="Constant" href="quickfix.html#location-list" name="location-list">location-list</a> <a class="Constant" href="quickfix.html#E776" name="E776">E776</a><br>
A location list is a window-local quickfix list. You get one after commands<br>
like <a class="Comment" href="quickfix.html#:lvimgrep">:lvimgrep</a>, <a class="Comment" href="quickfix.html#:lgrep">:lgrep</a>, <a class="Comment" href="helphelp.html#:lhelpgrep">:lhelpgrep</a>, <a class="Comment" href="quickfix.html#:lmake">:lmake</a>, etc., which create a<br>
location list instead of a quickfix list as the corresponding <a class="Comment" href="quickfix.html#:vimgrep">:vimgrep</a>,<br>
<a class="Comment" href="quickfix.html#:grep">:grep</a>, <a class="Comment" href="helphelp.html#:helpgrep">:helpgrep</a>, <a class="Comment" href="quickfix.html#:make">:make</a> do.<br>
A location list is associated with a window and each window can have a<br>
separate location list. A location list can be associated with only one<br>
window. The location list is independent of the quickfix list.<br>
<br>
When a window with a location list is split, the new window gets a copy of the<br>
location list. When there are no longer any references to a location list,<br>
the location list is destroyed.<br>
<br>
The following quickfix commands can be used. The location list commands are<br>
similar to the quickfix commands, replacing the 'c' prefix in the quickfix<br>
command with 'l'.<br>
<br>
<a class="Constant" href="quickfix.html#E924" name="E924">E924</a><br>
If the current window was closed by an <a class="Identifier" href="autocmd.html#autocommand">autocommand</a> while processing a<br>
location list command, it will be aborted.<br>
<br>
<a class="Constant" href="quickfix.html#E925" name="E925">E925</a> <a class="Constant" href="quickfix.html#E926" name="E926">E926</a><br>
If the current quickfix or location list was changed by an <a class="Identifier" href="autocmd.html#autocommand">autocommand</a> while<br>
processing a quickfix or location list command, it will be aborted.<br>
<br>
<a class="Constant" href="quickfix.html#:cc" name=":cc">:cc</a><br>
:cc[!] <span class="Special">[nr]</span> Display error <span class="Special">[nr]</span>. If <span class="Special">[nr]</span> is omitted, the same<br>
error is displayed again. Without [!] this doesn't<br>
work when jumping to another buffer, the current buffer<br>
has been changed, there is the only window for the<br>
buffer and both <a class="Type" href="options.html#'hidden'">'hidden'</a> and <a class="Type" href="options.html#'autowrite'">'autowrite'</a> are off.<br>
When jumping to another buffer with [!] any changes to<br>
the current buffer are lost, unless <a class="Type" href="options.html#'hidden'">'hidden'</a> is set or<br>
there is another window for this buffer.<br>
The <a class="Type" href="options.html#'switchbuf'">'switchbuf'</a> settings are respected when jumping<br>
to a buffer.<br>
<br>
<a class="Constant" href="quickfix.html#:ll" name=":ll">:ll</a><br>
:ll[!] <span class="Special">[nr]</span> Same as ":cc", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cn" name=":cn">:cn</a> <a class="Constant" href="quickfix.html#:cnext" name=":cnext">:cnext</a> <a class="Constant" href="quickfix.html#E553" name="E553">E553</a><br>
:<span class="Special">[count]</span>cn[ext][!] Display the <span class="Special">[count]</span> next error in the list that<br>
includes a file name. If there are no file names at<br>
all, go to the <span class="Special">[count]</span> next error. See <a class="Identifier" href="quickfix.html#:cc">:cc</a> for<br>
[!] and <a class="Type" href="options.html#'switchbuf'">'switchbuf'</a>.<br>
<br>
<a class="Constant" href="quickfix.html#:lne" name=":lne">:lne</a> <a class="Constant" href="quickfix.html#:lnext" name=":lnext">:lnext</a><br>
:<span class="Special">[count]</span>lne[xt][!] Same as ":cnext", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
:<span class="Special">[count]</span>cN[ext][!] <a class="Constant" href="quickfix.html#:cp" name=":cp">:cp</a> <a class="Constant" href="quickfix.html#:cprevious" name=":cprevious">:cprevious</a> <a class="Constant" href="quickfix.html#:cN" name=":cN">:cN</a> <a class="Constant" href="quickfix.html#:cNext" name=":cNext">:cNext</a><br>
:<span class="Special">[count]</span>cp[revious][!] Display the <span class="Special">[count]</span> previous error in the list that<br>
includes a file name. If there are no file names at<br>
all, go to the <span class="Special">[count]</span> previous error. See <a class="Identifier" href="quickfix.html#:cc">:cc</a> for<br>
[!] and <a class="Type" href="options.html#'switchbuf'">'switchbuf'</a>.<br>
<br>
<br>
:<span class="Special">[count]</span>lN[ext][!] <a class="Constant" href="quickfix.html#:lp" name=":lp">:lp</a> <a class="Constant" href="quickfix.html#:lprevious" name=":lprevious">:lprevious</a> <a class="Constant" href="quickfix.html#:lN" name=":lN">:lN</a> <a class="Constant" href="quickfix.html#:lNext" name=":lNext">:lNext</a><br>
:<span class="Special">[count]</span>lp[revious][!] Same as ":cNext" and ":cprevious", except the location<br>
list for the current window is used instead of the<br>
quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cnf" name=":cnf">:cnf</a> <a class="Constant" href="quickfix.html#:cnfile" name=":cnfile">:cnfile</a><br>
:<span class="Special">[count]</span>cnf[ile][!] Display the first error in the <span class="Special">[count]</span> next file in<br>
the list that includes a file name. If there are no<br>
file names at all or if there is no next file, go to<br>
the <span class="Special">[count]</span> next error. See <a class="Identifier" href="quickfix.html#:cc">:cc</a> for [!] and<br>
<a class="Type" href="options.html#'switchbuf'">'switchbuf'</a>.<br>
<br>
<a class="Constant" href="quickfix.html#:lnf" name=":lnf">:lnf</a> <a class="Constant" href="quickfix.html#:lnfile" name=":lnfile">:lnfile</a><br>
:<span class="Special">[count]</span>lnf[ile][!] Same as ":cnfile", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
:<span class="Special">[count]</span>cNf[ile][!] <a class="Constant" href="quickfix.html#:cpf" name=":cpf">:cpf</a> <a class="Constant" href="quickfix.html#:cpfile" name=":cpfile">:cpfile</a> <a class="Constant" href="quickfix.html#:cNf" name=":cNf">:cNf</a> <a class="Constant" href="quickfix.html#:cNfile" name=":cNfile">:cNfile</a><br>
:<span class="Special">[count]</span>cpf[ile][!] Display the last error in the <span class="Special">[count]</span> previous file in<br>
the list that includes a file name. If there are no<br>
file names at all or if there is no next file, go to<br>
the <span class="Special">[count]</span> previous error. See <a class="Identifier" href="quickfix.html#:cc">:cc</a> for [!] and<br>
<a class="Type" href="options.html#'switchbuf'">'switchbuf'</a>.<br>
<br>
<br>
:<span class="Special">[count]</span>lNf[ile][!] <a class="Constant" href="quickfix.html#:lpf" name=":lpf">:lpf</a> <a class="Constant" href="quickfix.html#:lpfile" name=":lpfile">:lpfile</a> <a class="Constant" href="quickfix.html#:lNf" name=":lNf">:lNf</a> <a class="Constant" href="quickfix.html#:lNfile" name=":lNfile">:lNfile</a><br>
:<span class="Special">[count]</span>lpf[ile][!] Same as ":cNfile" and ":cpfile", except the location<br>
list for the current window is used instead of the<br>
quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:crewind" name=":crewind">:crewind</a> <a class="Constant" href="quickfix.html#:cr" name=":cr">:cr</a><br>
:cr[ewind][!] <span class="Special">[nr]</span> Display error <span class="Special">[nr]</span>. If <span class="Special">[nr]</span> is omitted, the FIRST<br>
error is displayed. See <a class="Identifier" href="quickfix.html#:cc">:cc</a>.<br>
<br>
<a class="Constant" href="quickfix.html#:lrewind" name=":lrewind">:lrewind</a> <a class="Constant" href="quickfix.html#:lr" name=":lr">:lr</a><br>
:lr[ewind][!] <span class="Special">[nr]</span> Same as ":crewind", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cfirst" name=":cfirst">:cfirst</a> <a class="Constant" href="quickfix.html#:cfir" name=":cfir">:cfir</a><br>
:cfir[st][!] <span class="Special">[nr]</span> Same as ":crewind".<br>
<br>
<a class="Constant" href="quickfix.html#:lfirst" name=":lfirst">:lfirst</a> <a class="Constant" href="quickfix.html#:lfir" name=":lfir">:lfir</a><br>
:lfir[st][!] <span class="Special">[nr]</span> Same as ":lrewind".<br>
<br>
<a class="Constant" href="quickfix.html#:clast" name=":clast">:clast</a> <a class="Constant" href="quickfix.html#:cla" name=":cla">:cla</a><br>
:cla[st][!] <span class="Special">[nr]</span> Display error <span class="Special">[nr]</span>. If <span class="Special">[nr]</span> is omitted, the LAST<br>
error is displayed. See <a class="Identifier" href="quickfix.html#:cc">:cc</a>.<br>
<br>
<a class="Constant" href="quickfix.html#:llast" name=":llast">:llast</a> <a class="Constant" href="quickfix.html#:lla" name=":lla">:lla</a><br>
:lla[st][!] <span class="Special">[nr]</span> Same as ":clast", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cq" name=":cq">:cq</a> <a class="Constant" href="quickfix.html#:cquit" name=":cquit">:cquit</a><br>
:cq[uit][!] Quit Vim with an error code, so that the compiler<br>
will not compile the same file again.<br>
WARNING: All changes in files are lost! Also when the<br>
[!] is not used. It works like ":qall!" <a class="Identifier" href="editing.html#:qall">:qall</a>,<br>
except that Vim returns a non-zero exit code.<br>
<br>
<a class="Constant" href="quickfix.html#:cf" name=":cf">:cf</a> <a class="Constant" href="quickfix.html#:cfile" name=":cfile">:cfile</a><br>
:cf[ile][!] <span class="Special">[errorfile]</span> Read the error file and jump to the first error.<br>
This is done automatically when Vim is started with<br>
the -q option. You can use this command when you<br>
keep Vim running while compiling. If you give the<br>
name of the errorfile, the <a class="Type" href="options.html#'errorfile'">'errorfile'</a> option will<br>
be set to <span class="Special">[errorfile]</span>. See <a class="Identifier" href="quickfix.html#:cc">:cc</a> for [!].<br>
If the encoding of the error file differs from the<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a> option, you can use the <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a><br>
option to specify the encoding.<br>
<br>
<a class="Constant" href="quickfix.html#:lf" name=":lf">:lf</a> <a class="Constant" href="quickfix.html#:lfile" name=":lfile">:lfile</a><br>
:lf[ile][!] <span class="Special">[errorfile]</span> Same as ":cfile", except the location list for the<br>
current window is used instead of the quickfix list.<br>
You can not use the -q command-line option to set<br>
the location list.<br>
<br>
<br>
:cg[etfile] <span class="Special">[errorfile]</span> <a class="Constant" href="quickfix.html#:cg" name=":cg">:cg</a> <a class="Constant" href="quickfix.html#:cgetfile" name=":cgetfile">:cgetfile</a><br>
Read the error file. Just like ":cfile" but don't<br>
jump to the first error.<br>
If the encoding of the error file differs from the<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a> option, you can use the <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a><br>
option to specify the encoding.<br>
<br>
<br>
:lg[etfile] <span class="Special">[errorfile]</span> <a class="Constant" href="quickfix.html#:lg" name=":lg">:lg</a> <a class="Constant" href="quickfix.html#:lgetfile" name=":lgetfile">:lgetfile</a><br>
Same as ":cgetfile", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:caddf" name=":caddf">:caddf</a> <a class="Constant" href="quickfix.html#:caddfile" name=":caddfile">:caddfile</a><br>
:caddf[ile] <span class="Special">[errorfile]</span> Read the error file and add the errors from the<br>
errorfile to the current quickfix list. If a quickfix<br>
list is not present, then a new list is created.<br>
If the encoding of the error file differs from the<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a> option, you can use the <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a><br>
option to specify the encoding.<br>
<br>
<a class="Constant" href="quickfix.html#:laddf" name=":laddf">:laddf</a> <a class="Constant" href="quickfix.html#:laddfile" name=":laddfile">:laddfile</a><br>
:laddf[ile] <span class="Special">[errorfile]</span> Same as ":caddfile", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cb" name=":cb">:cb</a> <a class="Constant" href="quickfix.html#:cbuffer" name=":cbuffer">:cbuffer</a> <a class="Constant" href="quickfix.html#E681" name="E681">E681</a><br>
:cb[uffer][!] <span class="Special">[bufnr]</span> Read the error list from the current buffer.<br>
When <span class="Special">[bufnr]</span> is given it must be the number of a<br>
loaded buffer. That buffer will then be used instead<br>
of the current buffer.<br>
A range can be specified for the lines to be used.<br>
Otherwise all lines in the buffer are used.<br>
See <a class="Identifier" href="quickfix.html#:cc">:cc</a> for [!].<br>
<br>
<a class="Constant" href="quickfix.html#:lb" name=":lb">:lb</a> <a class="Constant" href="quickfix.html#:lbuffer" name=":lbuffer">:lbuffer</a><br>
:lb[uffer][!] <span class="Special">[bufnr]</span> Same as ":cbuffer", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cgetb" name=":cgetb">:cgetb</a> <a class="Constant" href="quickfix.html#:cgetbuffer" name=":cgetbuffer">:cgetbuffer</a><br>
:cgetb[uffer] <span class="Special">[bufnr]</span> Read the error list from the current buffer. Just<br>
like ":cbuffer" but don't jump to the first error.<br>
<br>
<a class="Constant" href="quickfix.html#:lgetb" name=":lgetb">:lgetb</a> <a class="Constant" href="quickfix.html#:lgetbuffer" name=":lgetbuffer">:lgetbuffer</a><br>
:lgetb[uffer] <span class="Special">[bufnr]</span> Same as ":cgetbuffer", except the location list for<br>
the current window is used instead of the quickfix<br>
list.<br>
<br>
<a class="Constant" href="quickfix.html#:cad" name=":cad">:cad</a> <a class="Constant" href="quickfix.html#:caddbuffer" name=":caddbuffer">:caddbuffer</a><br>
:cad[dbuffer] <span class="Special">[bufnr]</span> Read the error list from the current buffer and add<br>
the errors to the current quickfix list. If a<br>
quickfix list is not present, then a new list is<br>
created. Otherwise, same as ":cbuffer".<br>
<br>
<a class="Constant" href="quickfix.html#:laddb" name=":laddb">:laddb</a> <a class="Constant" href="quickfix.html#:laddbuffer" name=":laddbuffer">:laddbuffer</a><br>
:laddb[uffer] <span class="Special">[bufnr]</span> Same as ":caddbuffer", except the location list for<br>
the current window is used instead of the quickfix<br>
list.<br>
<br>
<a class="Constant" href="quickfix.html#:cex" name=":cex">:cex</a> <a class="Constant" href="quickfix.html#:cexpr" name=":cexpr">:cexpr</a> <a class="Constant" href="quickfix.html#E777" name="E777">E777</a><br>
:cex[pr][!] <span class="Special">{expr}</span> Create a quickfix list using the result of <span class="Special">{expr}</span> and<br>
jump to the first error.<br>
If <span class="Special">{expr}</span> is a String, then each new-line terminated<br>
line in the String is processed using the global value<br>
of <a class="Type" href="options.html#'errorformat'">'errorformat'</a> and the result is added to the<br>
quickfix list.<br>
If <span class="Special">{expr}</span> is a List, then each String item in the list<br>
is processed and added to the quickfix list. Non<br>
String items in the List are ignored.<br>
See <a class="Identifier" href="quickfix.html#:cc">:cc</a> for [!].<br>
Examples:<br>
<div class="helpExample"> :cexpr system('grep -n xyz *')<br>
:cexpr getline(1, '$')</div>
<br>
<a class="Constant" href="quickfix.html#:lex" name=":lex">:lex</a> <a class="Constant" href="quickfix.html#:lexpr" name=":lexpr">:lexpr</a><br>
:lex[pr][!] <span class="Special">{expr}</span> Same as <a class="Identifier" href="quickfix.html#:cexpr">:cexpr</a>, except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cgete" name=":cgete">:cgete</a> <a class="Constant" href="quickfix.html#:cgetexpr" name=":cgetexpr">:cgetexpr</a><br>
:cgete[xpr] <span class="Special">{expr}</span> Create a quickfix list using the result of <span class="Special">{expr}</span>.<br>
Just like <a class="Identifier" href="quickfix.html#:cexpr">:cexpr</a>, but don't jump to the first error.<br>
<br>
<a class="Constant" href="quickfix.html#:lgete" name=":lgete">:lgete</a> <a class="Constant" href="quickfix.html#:lgetexpr" name=":lgetexpr">:lgetexpr</a><br>
:lgete[xpr] <span class="Special">{expr}</span> Same as <a class="Identifier" href="quickfix.html#:cgetexpr">:cgetexpr</a>, except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cadde" name=":cadde">:cadde</a> <a class="Constant" href="quickfix.html#:caddexpr" name=":caddexpr">:caddexpr</a><br>
:cadde[xpr] <span class="Special">{expr}</span> Evaluate <span class="Special">{expr}</span> and add the resulting lines to the<br>
current quickfix list. If a quickfix list is not<br>
present, then a new list is created. The current<br>
cursor position will not be changed. See <a class="Identifier" href="quickfix.html#:cexpr">:cexpr</a> for<br>
more information.<br>
Example:<br>
<div class="helpExample"> :g/mypattern/caddexpr expand("%") . ":" . line(".") . ":" . getline(".")</div>
<br>
<a class="Constant" href="quickfix.html#:lad" name=":lad">:lad</a> <a class="Constant" href="quickfix.html#:laddexpr" name=":laddexpr">:laddexpr</a><br>
:lad[dexpr] <span class="Special">{expr}</span> Same as ":caddexpr", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cl" name=":cl">:cl</a> <a class="Constant" href="quickfix.html#:clist" name=":clist">:clist</a><br>
:cl[ist] <span class="Special">[from]</span> [, <span class="Special">[to]</span>]<br>
List all errors that are valid <a class="Identifier" href="quickfix.html#quickfix-valid">quickfix-valid</a>.<br>
If numbers <span class="Special">[from]</span> and/or <span class="Special">[to]</span> are given, the respective<br>
range of errors is listed. A negative number counts<br>
from the last error backwards, -1 being the last error.<br>
The <a class="Type" href="options.html#'switchbuf'">'switchbuf'</a> settings are respected when jumping<br>
to a buffer.<br>
<br>
:cl[ist] +<span class="Special">{count}</span> List the current and next <span class="Special">{count}</span> valid errors. This<br>
is similar to ":clist from from+count", where "from"<br>
is the current error position.<br>
<br>
:cl[ist]! <span class="Special">[from]</span> [, <span class="Special">[to]</span>]<br>
List all errors.<br>
<br>
:cl[ist]! +<span class="Special">{count}</span> List the current and next <span class="Special">{count}</span> error lines. This<br>
is useful to see unrecognized lines after the current<br>
one. For example, if ":clist" shows:<br>
<span class="PreProc">8384 testje.java:252: error: cannot find symbol</span><br>
Then using ":cl! +3" shows the reason:<br>
<span class="PreProc">8384 testje.java:252: error: cannot find symbol</span><br>
<span class="PreProc">8385: ZexitCode = Fmainx();</span><br>
<span class="PreProc">8386: ^</span><br>
<span class="PreProc">8387: symbol: method Fmainx()</span><br>
<br>
:lli[st] <span class="Special">[from]</span> [, <span class="Special">[to]</span>] <a class="Constant" href="quickfix.html#:lli" name=":lli">:lli</a> <a class="Constant" href="quickfix.html#:llist" name=":llist">:llist</a><br>
Same as ":clist", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
:lli[st]! <span class="Special">[from]</span> [, <span class="Special">[to]</span>]<br>
List all the entries in the location list for the<br>
current window.<br>
<br>
If you insert or delete lines, mostly the correct error location is still<br>
found because hidden marks are used. Sometimes, when the mark has been<br>
deleted for some reason, the message "line changed" is shown to warn you that<br>
the error location may not be correct. If you quit Vim and start again the<br>
marks are lost and the error locations may not be correct anymore.<br>
<br>
If vim is built with <a class="Identifier" href="various.html#+autocmd">+autocmd</a> support, two autocommands are available for<br>
running commands before and after a quickfix command (':make', ':grep' and so<br>
on) is executed. See <a class="Identifier" href="autocmd.html#QuickFixCmdPre">QuickFixCmdPre</a> and <a class="Identifier" href="autocmd.html#QuickFixCmdPost">QuickFixCmdPost</a> for details.<br>
<br>
<a class="Constant" href="quickfix.html#QuickFixCmdPost-example" name="QuickFixCmdPost-example">QuickFixCmdPost-example</a><br>
When <a class="Type" href="options.html#'encoding'">'encoding'</a> differs from the locale, the error messages may have a<br>
different encoding from what Vim is using. To convert the messages you can<br>
use this code:<br>
<div class="helpExample"> function QfMakeConv()<br>
let qflist = getqflist()<br>
for i in qflist<br>
let i.text = iconv(i.text, "cp936", "utf-8")<br>
endfor<br>
call setqflist(qflist)<br>
endfunction</div>
<br>
<div class="helpExample"> au QuickfixCmdPost make call QfMakeConv()</div>
Another option is using <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a>.<br>
<br>
<br>
EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:<br>
<a class="Constant" href="quickfix.html#:cdo" name=":cdo">:cdo</a><br>
:cdo[!] <span class="Special">{cmd}</span> Execute <span class="Special">{cmd}</span> in each valid entry in the quickfix list.<br>
It works like doing this:<br>
<div class="helpExample"> :cfirst<br>
:{cmd}<br>
:cnext<br>
:{cmd}<br>
etc.</div>
When the current file can't be <a class="Identifier" href="editing.html#abandon">abandon</a>ed and the [!]<br>
is not present, the command fails.<br>
When an error is detected execution stops.<br>
The last buffer (or where an error occurred) becomes<br>
the current buffer.<br>
<span class="Special">{cmd}</span> can contain '|' to concatenate several commands.<br>
<br>
Only valid entries in the quickfix list are used.<br>
A range can be used to select entries, e.g.:<br>
<div class="helpExample"> :10,$cdo cmd</div>
To skip entries 1 to 9.<br>
<br>
<span class="Todo">Note</span>: While this command is executing, the Syntax<br>
autocommand event is disabled by adding it to<br>
<a class="Type" href="options.html#'eventignore'">'eventignore'</a>. This considerably speeds up editing<br>
each buffer.<br>
<span class="Special">{not in Vi}</span> <span class="Special">{not available when compiled without the</span><br>
<a class="Identifier" href="various.html#+listcmds">+listcmds</a><span class="Special"> feature}</span><br>
Also see <a class="Identifier" href="windows.html#:bufdo">:bufdo</a>, <a class="Identifier" href="tabpage.html#:tabdo">:tabdo</a>, <a class="Identifier" href="editing.html#:argdo">:argdo</a>, <a class="Identifier" href="windows.html#:windo">:windo</a>,<br>
<a class="Identifier" href="quickfix.html#:ldo">:ldo</a>, <a class="Identifier" href="quickfix.html#:cfdo">:cfdo</a> and <a class="Identifier" href="quickfix.html#:lfdo">:lfdo</a>.<br>
<br>
<a class="Constant" href="quickfix.html#:cfdo" name=":cfdo">:cfdo</a><br>
:cfdo[!] <span class="Special">{cmd}</span> Execute <span class="Special">{cmd}</span> in each file in the quickfix list.<br>
It works like doing this:<br>
<div class="helpExample"> :cfirst<br>
:{cmd}<br>
:cnfile<br>
:{cmd}<br>
etc.</div>
Otherwise it works the same as <a class="Comment" href="quickfix.html#:cdo">:cdo</a>.<br>
<span class="Special">{not in Vi}</span> <span class="Special">{not available when compiled without the</span><br>
<a class="Identifier" href="various.html#+listcmds">+listcmds</a><span class="Special"> feature}</span><br>
<br>
<a class="Constant" href="quickfix.html#:ldo" name=":ldo">:ldo</a><br>
:ld[o][!] <span class="Special">{cmd}</span> Execute <span class="Special">{cmd}</span> in each valid entry in the location list<br>
for the current window.<br>
It works like doing this:<br>
<div class="helpExample"> :lfirst<br>
:{cmd}<br>
:lnext<br>
:{cmd}<br>
etc.</div>
Only valid entries in the location list are used.<br>
Otherwise it works the same as <a class="Comment" href="quickfix.html#:cdo">:cdo</a>.<br>
<span class="Special">{not in Vi}</span> <span class="Special">{not available when compiled without the</span><br>
<a class="Identifier" href="various.html#+listcmds">+listcmds</a><span class="Special"> feature}</span><br>
<br>
<a class="Constant" href="quickfix.html#:lfdo" name=":lfdo">:lfdo</a><br>
:lfdo[!] <span class="Special">{cmd}</span> Execute <span class="Special">{cmd}</span> in each file in the location list for<br>
the current window.<br>
It works like doing this:<br>
<div class="helpExample"> :lfirst<br>
:{cmd}<br>
:lnfile<br>
:{cmd}<br>
etc.</div>
Otherwise it works the same as <a class="Comment" href="quickfix.html#:ldo">:ldo</a>.<br>
<span class="Special">{not in Vi}</span> <span class="Special">{not available when compiled without the</span><br>
<a class="Identifier" href="various.html#+listcmds">+listcmds</a><span class="Special"> feature}</span><br>
<br>
<span class="PreProc">=============================================================================</span><br>
2. The error window <a class="Constant" href="quickfix.html#quickfix-window" name="quickfix-window">quickfix-window</a><br>
<br>
<a class="Constant" href="quickfix.html#:cope" name=":cope">:cope</a> <a class="Constant" href="quickfix.html#:copen" name=":copen">:copen</a> <a class="Constant" href="quickfix.html#w:quickfix_title" name="w:quickfix_title">w:quickfix_title</a><br>
:cope[n] <span class="Special">[height]</span> Open a window to show the current list of errors.<br>
<br>
When <span class="Special">[height]</span> is given, the window becomes that high<br>
(if there is room). When <span class="Special">[height]</span> is omitted the<br>
window is made ten lines high.<br>
<br>
If there already is a quickfix window, it will be made<br>
the current window. It is not possible to open a<br>
second quickfix window. If <span class="Special">[height]</span> is given the<br>
existing window will be resized to it.<br>
<br>
The window will contain a special buffer, with<br>
<a class="Type" href="options.html#'buftype'">'buftype'</a> equal to "quickfix". Don't change this!<br>
The window will have the w:quickfix_title variable set<br>
which will indicate the command that produced the<br>
quickfix list. This can be used to compose a custom<br>
status line if the value of <a class="Type" href="options.html#'statusline'">'statusline'</a> is adjusted<br>
properly. Whenever this buffer is modified by a<br>
quickfix command or function, the <a class="Identifier" href="eval.html#b:changedtick">b:changedtick</a><br>
variable is incremented.<br>
<br>
<a class="Constant" href="quickfix.html#:lop" name=":lop">:lop</a> <a class="Constant" href="quickfix.html#:lopen" name=":lopen">:lopen</a><br>
:lop[en] <span class="Special">[height]</span> Open a window to show the location list for the<br>
current window. Works only when the location list for<br>
the current window is present. You can have more than<br>
one location window opened at a time. Otherwise, it<br>
acts the same as ":copen".<br>
<br>
<a class="Constant" href="quickfix.html#:ccl" name=":ccl">:ccl</a> <a class="Constant" href="quickfix.html#:cclose" name=":cclose">:cclose</a><br>
:ccl[ose] Close the quickfix window.<br>
<br>
<a class="Constant" href="quickfix.html#:lcl" name=":lcl">:lcl</a> <a class="Constant" href="quickfix.html#:lclose" name=":lclose">:lclose</a><br>
:lcl[ose] Close the window showing the location list for the<br>
current window.<br>
<br>
<a class="Constant" href="quickfix.html#:cw" name=":cw">:cw</a> <a class="Constant" href="quickfix.html#:cwindow" name=":cwindow">:cwindow</a><br>
:cw[indow] <span class="Special">[height]</span> Open the quickfix window when there are recognized<br>
errors. If the window is already open and there are<br>
no recognized errors, close the window.<br>
<br>
<a class="Constant" href="quickfix.html#:lw" name=":lw">:lw</a> <a class="Constant" href="quickfix.html#:lwindow" name=":lwindow">:lwindow</a><br>
:lw[indow] <span class="Special">[height]</span> Same as ":cwindow", except use the window showing the<br>
location list for the current window.<br>
<br>
<a class="Constant" href="quickfix.html#:cbo" name=":cbo">:cbo</a> <a class="Constant" href="quickfix.html#:cbottom" name=":cbottom">:cbottom</a><br>
:cbo[ttom] Put the cursor in the last line of the quickfix window<br>
and scroll to make it visible. This is useful for<br>
when errors are added by an asynchronous callback.<br>
Only call it once in a while if there are many<br>
updates to avoid a lot of redrawing.<br>
<br>
<a class="Constant" href="quickfix.html#:lbo" name=":lbo">:lbo</a> <a class="Constant" href="quickfix.html#:lbottom" name=":lbottom">:lbottom</a><br>
:lbo[ttom] Same as ":cbottom", except use the window showing the<br>
location list for the current window.<br>
<br>
Normally the quickfix window is at the bottom of the screen. If there are<br>
vertical splits, it's at the bottom of the rightmost column of windows. To<br>
make it always occupy the full width:<br>
<div class="helpExample"> :botright cwindow</div>
You can move the window around with <a class="Identifier" href="windows.html#window-moving">window-moving</a> commands.<br>
For example, to move it to the top: <span class="Special">CTRL-W</span> K<br>
The <a class="Type" href="options.html#'winfixheight'">'winfixheight'</a> option will be set, which means that the window will mostly<br>
keep its height, ignoring <a class="Type" href="options.html#'winheight'">'winheight'</a> and <a class="Type" href="options.html#'equalalways'">'equalalways'</a>. You can change the<br>
height manually (e.g., by dragging the status line above it with the mouse).<br>
<br>
In the quickfix window, each line is one error. The line number is equal to<br>
the error number. The current entry is highlighted with the QuickFixLine<br>
highlighting. You can change it to your liking, e.g.:<br>
<div class="helpExample"> :hi QuickFixLine ctermbg=Yellow guibg=Yellow</div>
<br>
You can use ":.cc" to jump to the error under the cursor.<br>
Hitting the <span class="Special"><Enter></span> key or double-clicking the mouse on a line has the same<br>
effect. The file containing the error is opened in the window above the<br>
quickfix window. If there already is a window for that file, it is used<br>
instead. If the buffer in the used window has changed, and the error is in<br>
another file, jumping to the error will fail. You will first have to make<br>
sure the window contains a buffer which can be abandoned.<br>
<a class="Constant" href="quickfix.html#CTRL-W_<Enter>" name="CTRL-W_<Enter>">CTRL-W_<Enter></a> <a class="Constant" href="quickfix.html#CTRL-W_<CR>" name="CTRL-W_<CR>">CTRL-W_<CR></a><br>
You can use <span class="Special">CTRL-W</span> <span class="Special"><Enter></span> to open a new window and jump to the error there.<br>
<br>
When the quickfix window has been filled, two autocommand events are<br>
triggered. First the <a class="Type" href="options.html#'filetype'">'filetype'</a> option is set to "qf", which triggers the<br>
FileType event. Then the BufReadPost event is triggered, using "quickfix" for<br>
the buffer name. This can be used to perform some action on the listed<br>
errors. Example:<br>
<div class="helpExample"> au BufReadPost quickfix setlocal modifiable<br>
\ | silent exe 'g/^/s//\=line(".")." "/'<br>
\ | setlocal nomodifiable</div>
This prepends the line number to each line. <span class="Todo">Note</span> the use of "\=" in the<br>
substitute string of the ":s" command, which is used to evaluate an<br>
expression.<br>
The BufWinEnter event is also triggered, again using "quickfix" for the buffer<br>
name.<br>
<br>
<span class="Todo">Note</span>: When adding to an existing quickfix list the autocommand are not<br>
triggered.<br>
<br>
<span class="Todo">Note</span>: Making changes in the quickfix window has no effect on the list of<br>
errors. <a class="Type" href="options.html#'modifiable'">'modifiable'</a> is off to avoid making changes. If you delete or insert<br>
lines anyway, the relation between the text and the error number is messed up.<br>
If you really want to do this, you could write the contents of the quickfix<br>
window to a file and use ":cfile" to have it parsed and used as the new error<br>
list.<br>
<br>
<a class="Constant" href="quickfix.html#location-list-window" name="location-list-window">location-list-window</a><br>
The location list window displays the entries in a location list. When you<br>
open a location list window, it is created below the current window and<br>
displays the location list for the current window. The location list window<br>
is similar to the quickfix window, except that you can have more than one<br>
location list window open at a time. When you use a location list command in<br>
this window, the displayed location list is used.<br>
<br>
When you select a file from the location list window, the following steps are<br>
used to find a window to edit the file:<br>
<br>
1. If a window with the location list displayed in the location list window is<br>
present, then the file is opened in that window.<br>
2. If the above step fails and if the file is already opened in another<br>
window, then that window is used.<br>
3. If the above step fails then an existing window showing a buffer with<br>
<a class="Type" href="options.html#'buftype'">'buftype'</a> not set is used.<br>
4. If the above step fails, then the file is edited in a new window.<br>
<br>
In all of the above cases, if the location list for the selected window is not<br>
yet set, then it is set to the location list displayed in the location list<br>
window.<br>
<br>
<span class="PreProc">=============================================================================</span><br>
3. Using more than one list of errors <a class="Constant" href="quickfix.html#quickfix-error-lists" name="quickfix-error-lists">quickfix-error-lists</a><br>
<br>
So far has been assumed that there is only one list of errors. Actually the<br>
ten last used lists are remembered. When starting a new list, the previous<br>
ones are automatically kept. Two commands can be used to access older error<br>
lists. They set one of the existing error lists as the current one.<br>
<br>
<a class="Constant" href="quickfix.html#:colder" name=":colder">:colder</a> <a class="Constant" href="quickfix.html#:col" name=":col">:col</a> <a class="Constant" href="quickfix.html#E380" name="E380">E380</a><br>
:col[der] <span class="Special">[count]</span> Go to older error list. When <span class="Special">[count]</span> is given, do<br>
this <span class="Special">[count]</span> times. When already at the oldest error<br>
list, an error message is given.<br>
<br>
<a class="Constant" href="quickfix.html#:lolder" name=":lolder">:lolder</a> <a class="Constant" href="quickfix.html#:lol" name=":lol">:lol</a><br>
:lol[der] <span class="Special">[count]</span> Same as <a class="Comment" href="quickfix.html#:colder">:colder</a>, except use the location list for<br>
the current window instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:cnewer" name=":cnewer">:cnewer</a> <a class="Constant" href="quickfix.html#:cnew" name=":cnew">:cnew</a> <a class="Constant" href="quickfix.html#E381" name="E381">E381</a><br>
:cnew[er] <span class="Special">[count]</span> Go to newer error list. When <span class="Special">[count]</span> is given, do<br>
this <span class="Special">[count]</span> times. When already at the newest error<br>
list, an error message is given.<br>
<br>
<a class="Constant" href="quickfix.html#:lnewer" name=":lnewer">:lnewer</a> <a class="Constant" href="quickfix.html#:lnew" name=":lnew">:lnew</a><br>
:lnew[er] <span class="Special">[count]</span> Same as <a class="Comment" href="quickfix.html#:cnewer">:cnewer</a>, except use the location list for<br>
the current window instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:chistory" name=":chistory">:chistory</a> <a class="Constant" href="quickfix.html#:chi" name=":chi">:chi</a><br>
:chi[story] Show the list of error lists. The current list is<br>
marked with ">". The output looks like:<br>
<span class="PreProc">error list 1 of 3; 43 errors</span><br>
<span class="PreProc">> error list 2 of 3; 0 errors</span><br>
<span class="PreProc">error list 3 of 3; 15 errors</span><br>
<br>
<a class="Constant" href="quickfix.html#:lhistory" name=":lhistory">:lhistory</a> <a class="Constant" href="quickfix.html#:lhi" name=":lhi">:lhi</a><br>
:lhi[story] Show the list of location lists, otherwise like<br>
<a class="Comment" href="quickfix.html#:chistory">:chistory</a>.<br>
<br>
When adding a new error list, it becomes the current list.<br>
<br>
When ":colder" has been used and ":make" or ":grep" is used to add a new error<br>
list, one newer list is overwritten. This is especially useful if you are<br>
browsing with ":grep" <a class="Identifier" href="quickfix.html#grep">grep</a>. If you want to keep the more recent error<br>
lists, use ":cnewer 99" first.<br>
<br>
<span class="PreProc">=============================================================================</span><br>
4. Using :make <a class="Constant" href="quickfix.html#:make_makeprg" name=":make_makeprg">:make_makeprg</a><br>
<br>
<a class="Constant" href="quickfix.html#:mak" name=":mak">:mak</a> <a class="Constant" href="quickfix.html#:make" name=":make">:make</a><br>
:mak[e][!] <span class="Special">[arguments]</span> 1. If vim was built with <a class="Identifier" href="various.html#+autocmd">+autocmd</a>, all relevant<br>
<a class="Identifier" href="autocmd.html#QuickFixCmdPre">QuickFixCmdPre</a> autocommands are executed.<br>
2. If the <a class="Type" href="options.html#'autowrite'">'autowrite'</a> option is on, write any changed<br>
buffers<br>
3. An errorfile name is made from <a class="Type" href="options.html#'makeef'">'makeef'</a>. If<br>
<a class="Type" href="options.html#'makeef'">'makeef'</a> doesn't contain "##", and a file with this<br>
name already exists, it is deleted.<br>
4. The program given with the <a class="Type" href="options.html#'makeprg'">'makeprg'</a> option is<br>
started (default "make") with the optional<br>
<span class="Special">[arguments]</span> and the output is saved in the<br>
errorfile (for Unix it is also echoed on the<br>
screen).<br>
5. The errorfile is read using <a class="Type" href="options.html#'errorformat'">'errorformat'</a>.<br>
6. If vim was built with <a class="Identifier" href="various.html#+autocmd">+autocmd</a>, all relevant<br>
<a class="Identifier" href="autocmd.html#QuickFixCmdPost">QuickFixCmdPost</a> autocommands are executed.<br>
See example below.<br>
7. If [!] is not given the first error is jumped to.<br>
8. The errorfile is deleted.<br>
9. You can now move through the errors with commands<br>
like <a class="Identifier" href="quickfix.html#:cnext">:cnext</a> and <a class="Identifier" href="quickfix.html#:cprevious">:cprevious</a>, see above.<br>
This command does not accept a comment, any "<br>
characters are considered part of the arguments.<br>
If the encoding of the program output differs from the<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a> option, you can use the <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a><br>
option to specify the encoding.<br>
<br>
<a class="Constant" href="quickfix.html#:lmak" name=":lmak">:lmak</a> <a class="Constant" href="quickfix.html#:lmake" name=":lmake">:lmake</a><br>
:lmak[e][!] <span class="Special">[arguments]</span><br>
Same as ":make", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
The ":make" command executes the command given with the <a class="Type" href="options.html#'makeprg'">'makeprg'</a> option.<br>
This is done by passing the command to the shell given with the <a class="Type" href="options.html#'shell'">'shell'</a><br>
option. This works almost like typing<br>
<br>
":!<span class="Special">{makeprg}</span> <span class="Special">[arguments]</span> <span class="Special">{shellpipe}</span> <span class="Special">{errorfile}</span>".<br>
<br>
<span class="Special">{makeprg}</span> is the string given with the <a class="Type" href="options.html#'makeprg'">'makeprg'</a> option. Any command can be<br>
used, not just "make". Characters '%' and '#' are expanded as usual on a<br>
command-line. You can use "%<" to insert the current file name without<br>
extension, or "#<" to insert the alternate file name without extension, for<br>
example:<br>
<div class="helpExample"> :set makeprg=make\ #<.o</div>
<br>
<span class="Special">[arguments]</span> is anything that is typed after ":make".<br>
<span class="Special">{shellpipe}</span> is the <a class="Type" href="options.html#'shellpipe'">'shellpipe'</a> option.<br>
<span class="Special">{errorfile}</span> is the <a class="Type" href="options.html#'makeef'">'makeef'</a> option, with ## replaced to make it unique.<br>
<br>
The placeholder "$*" can be used for the argument list in <span class="Special">{makeprg}</span> if the<br>
command needs some additional characters after its arguments. The $* is<br>
replaced then by all arguments. Example:<br>
<div class="helpExample"> :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}</div>
or simpler<br>
<div class="helpExample"> :let &mp = 'latex \\nonstopmode \\input\{$*}'</div>
"$*" can be given multiple times, for example:<br>
<div class="helpExample"> :set makeprg=gcc\ -o\ $*\ $*</div>
<br>
The <a class="Type" href="options.html#'shellpipe'">'shellpipe'</a> option defaults to ">" for the Amiga, MS-DOS and Win32. This<br>
means that the output of the compiler is saved in a file and not shown on the<br>
screen directly. For Unix "| tee" is used. The compiler output is shown on<br>
the screen and saved in a file the same time. Depending on the shell used<br>
"|& tee" or "2>&1| tee" is the default, so stderr output will be included.<br>
<br>
If <a class="Type" href="options.html#'shellpipe'">'shellpipe'</a> is empty, the <span class="Special">{errorfile}</span> part will be omitted. This is useful<br>
for compilers that write to an errorfile themselves (e.g., Manx's Amiga C).<br>
<br>
<br>
<span class="PreProc">Using QuickFixCmdPost to fix the encoding</span><br>
<br>
It may be that <a class="Type" href="options.html#'encoding'">'encoding'</a> is set to an encoding that differs from the messages<br>
your build program produces. This example shows how to fix this after Vim has<br>
read the error messages:<br>
<br>
<div class="helpExample"> function QfMakeConv()<br>
let qflist = getqflist()<br>
for i in qflist<br>
let i.text = iconv(i.text, "cp936", "utf-8")<br>
endfor<br>
call setqflist(qflist)<br>
endfunction</div>
<br>
<div class="helpExample"> au QuickfixCmdPost make call QfMakeConv()</div>
<br>
(Example by Faque Cheng)<br>
Another option is using <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
5. Using :vimgrep and :grep <a class="Constant" href="quickfix.html#grep" name="grep">grep</a> <a class="Constant" href="quickfix.html#lid" name="lid">lid</a><br>
<br>
Vim has two ways to find matches for a pattern: Internal and external. The<br>
advantage of the internal grep is that it works on all systems and uses the<br>
powerful Vim search patterns. An external grep program can be used when the<br>
Vim grep does not do what you want.<br>
<br>
The internal method will be slower, because files are read into memory. The<br>
advantages are:<br>
- Line separators and encoding are automatically recognized, as if a file is<br>
being edited.<br>
- Uses Vim search patterns. Multi-line patterns can be used.<br>
- When plugins are enabled: compressed and remote files can be searched.<br>
<a class="Identifier" href="pi_gzip.html#gzip">gzip</a> <a class="Identifier" href="pi_netrw.html#netrw">netrw</a><br>
<br>
To be able to do this Vim loads each file as if it is being edited. When<br>
there is no match in the file the associated buffer is wiped out again. The<br>
<a class="Type" href="options.html#'hidden'">'hidden'</a> option is ignored here to avoid running out of memory or file<br>
descriptors when searching many files. However, when the <a class="Identifier" href="windows.html#:hide">:hide</a> command<br>
modifier is used the buffers are kept loaded. This makes following searches<br>
in the same files a lot faster.<br>
<br>
<span class="Todo">Note</span> that <a class="Identifier" href="quickfix.html#:copen">:copen</a> (or <a class="Identifier" href="quickfix.html#:lopen">:lopen</a> for <a class="Identifier" href="quickfix.html#:lgrep">:lgrep</a>) may be used to open a buffer<br>
containing the search results in linked form. The <a class="Identifier" href="various.html#:silent">:silent</a> command may be<br>
used to suppress the default full screen grep output. The ":grep!" form of<br>
the <a class="Identifier" href="quickfix.html#:grep">:grep</a> command doesn't jump to the first match automatically. These<br>
commands can be combined to create a NewGrep command:<br>
<br>
<div class="helpExample"> command! -nargs=+ NewGrep execute 'silent grep! <args>' | copen 42</div>
<br>
<br>
5.1 using Vim's internal grep<br>
<br>
<a class="Constant" href="quickfix.html#:vim" name=":vim">:vim</a> <a class="Constant" href="quickfix.html#:vimgrep" name=":vimgrep">:vimgrep</a> <a class="Constant" href="quickfix.html#E682" name="E682">E682</a> <a class="Constant" href="quickfix.html#E683" name="E683">E683</a><br>
:vim[grep][!] /<span class="Special">{pattern}</span>/[g][j] <span class="Special">{file}</span> ...<br>
Search for <span class="Special">{pattern}</span> in the files <span class="Special">{file}</span> ... and set<br>
the error list to the matches. Files matching<br>
<a class="Type" href="options.html#'wildignore'">'wildignore'</a> are ignored; files in <a class="Type" href="options.html#'suffixes'">'suffixes'</a> are<br>
searched last.<br>
Without the 'g' flag each line is added only once.<br>
With 'g' every match is added.<br>
<br>
<span class="Special">{pattern}</span> is a Vim search pattern. Instead of<br>
enclosing it in / any non-ID character (see<br>
<a class="Identifier" href="options.html#'isident'">'isident'</a>) can be used, so long as it does not<br>
appear in <span class="Special">{pattern}</span>.<br>
<a class="Type" href="options.html#'ignorecase'">'ignorecase'</a> applies. To overrule it put <a class="Identifier" href="pattern.html#/\c">/\c</a> in the<br>
pattern to ignore case or <a class="Identifier" href="pattern.html#/\C">/\C</a> to match case.<br>
<a class="Type" href="options.html#'smartcase'">'smartcase'</a> is not used.<br>
If <span class="Special">{pattern}</span> is empty (e.g. // is specified), the last<br>
used search pattern is used. <a class="Identifier" href="pattern.html#last-pattern">last-pattern</a><br>
<br>
When a number is put before the command this is used<br>
as the maximum number of matches to find. Use<br>
":1vimgrep pattern file" to find only the first.<br>
Useful if you only want to check if there is a match<br>
and quit quickly when it's found.<br>
<br>
Without the 'j' flag Vim jumps to the first match.<br>
With 'j' only the quickfix list is updated.<br>
With the [!] any changes in the current buffer are<br>
abandoned.<br>
<br>
Every second or so the searched file name is displayed<br>
to give you an idea of the progress made.<br>
Examples:<br>
<div class="helpExample"> :vimgrep /an error/ *.c<br>
:vimgrep /\<FileName\>/ *.h include/*<br>
:vimgrep /myfunc/ **/*.c</div>
For the use of "**" see <a class="Identifier" href="editing.html#starstar-wildcard">starstar-wildcard</a>.<br>
<br>
:vim[grep][!] <span class="Special">{pattern}</span> <span class="Special">{file}</span> ...<br>
Like above, but instead of enclosing the pattern in a<br>
non-ID character use a white-separated pattern. The<br>
pattern must start with an ID character.<br>
Example:<br>
<div class="helpExample"> :vimgrep Error *.c</div>
<br>
<a class="Constant" href="quickfix.html#:lv" name=":lv">:lv</a> <a class="Constant" href="quickfix.html#:lvimgrep" name=":lvimgrep">:lvimgrep</a><br>
:lv[imgrep][!] /<span class="Special">{pattern}</span>/[g][j] <span class="Special">{file}</span> ...<br>
:lv[imgrep][!] <span class="Special">{pattern}</span> <span class="Special">{file}</span> ...<br>
Same as ":vimgrep", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:vimgrepa" name=":vimgrepa">:vimgrepa</a> <a class="Constant" href="quickfix.html#:vimgrepadd" name=":vimgrepadd">:vimgrepadd</a><br>
:vimgrepa[dd][!] /<span class="Special">{pattern}</span>/[g][j] <span class="Special">{file}</span> ...<br>
:vimgrepa[dd][!] <span class="Special">{pattern}</span> <span class="Special">{file}</span> ...<br>
Just like ":vimgrep", but instead of making a new list<br>
of errors the matches are appended to the current<br>
list.<br>
<br>
<a class="Constant" href="quickfix.html#:lvimgrepa" name=":lvimgrepa">:lvimgrepa</a> <a class="Constant" href="quickfix.html#:lvimgrepadd" name=":lvimgrepadd">:lvimgrepadd</a><br>
:lvimgrepa[dd][!] /<span class="Special">{pattern}</span>/[g][j] <span class="Special">{file}</span> ...<br>
:lvimgrepa[dd][!] <span class="Special">{pattern}</span> <span class="Special">{file}</span> ...<br>
Same as ":vimgrepadd", except the location list for<br>
the current window is used instead of the quickfix<br>
list.<br>
<br>
5.2 External grep<br>
<br>
Vim can interface with "grep" and grep-like programs (such as the GNU<br>
id-utils) in a similar way to its compiler integration (see <a class="Identifier" href="quickfix.html#:make">:make</a> above).<br>
<br>
[Unix trivia: The name for the Unix "grep" command comes from ":g/re/p", where<br>
"re" stands for Regular Expression.]<br>
<br>
<a class="Constant" href="quickfix.html#:gr" name=":gr">:gr</a> <a class="Constant" href="quickfix.html#:grep" name=":grep">:grep</a><br>
:gr[ep][!] <span class="Special">[arguments]</span> Just like ":make", but use <a class="Type" href="options.html#'grepprg'">'grepprg'</a> instead of<br>
<a class="Type" href="options.html#'makeprg'">'makeprg'</a> and <a class="Type" href="options.html#'grepformat'">'grepformat'</a> instead of <a class="Type" href="options.html#'errorformat'">'errorformat'</a>.<br>
When <a class="Type" href="options.html#'grepprg'">'grepprg'</a> is "internal" this works like<br>
<a class="Identifier" href="quickfix.html#:vimgrep">:vimgrep</a>. <span class="Todo">Note</span> that the pattern needs to be<br>
enclosed in separator characters then.<br>
If the encoding of the program output differs from the<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a> option, you can use the <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a><br>
option to specify the encoding.<br>
<br>
<a class="Constant" href="quickfix.html#:lgr" name=":lgr">:lgr</a> <a class="Constant" href="quickfix.html#:lgrep" name=":lgrep">:lgrep</a><br>
:lgr[ep][!] <span class="Special">[arguments]</span> Same as ":grep", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
<a class="Constant" href="quickfix.html#:grepa" name=":grepa">:grepa</a> <a class="Constant" href="quickfix.html#:grepadd" name=":grepadd">:grepadd</a><br>
:grepa[dd][!] <span class="Special">[arguments]</span><br>
Just like ":grep", but instead of making a new list of<br>
errors the matches are appended to the current list.<br>
Example:<br>
<div class="helpExample"> :call setqflist([])<br>
:bufdo grepadd! something %</div>
The first command makes a new error list which is<br>
empty. The second command executes "grepadd" for each<br>
listed buffer. <span class="Todo">Note</span> the use of ! to avoid that<br>
":grepadd" jumps to the first error, which is not<br>
allowed with <a class="Identifier" href="windows.html#:bufdo">:bufdo</a>.<br>
An example that uses the argument list and avoids<br>
errors for files without matches:<br>
<div class="helpExample"> :silent argdo try <br>
\ | grepadd! something %<br>
\ | catch /E480:/<br>
\ | endtry"</div>
<br>
If the encoding of the program output differs from the<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a> option, you can use the <a class="Type" href="options.html#'makeencoding'">'makeencoding'</a><br>
option to specify the encoding.<br>
<br>
<a class="Constant" href="quickfix.html#:lgrepa" name=":lgrepa">:lgrepa</a> <a class="Constant" href="quickfix.html#:lgrepadd" name=":lgrepadd">:lgrepadd</a><br>
:lgrepa[dd][!] <span class="Special">[arguments]</span><br>
Same as ":grepadd", except the location list for the<br>
current window is used instead of the quickfix list.<br>
<br>
5.3 Setting up external grep<br>
<br>
If you have a standard "grep" program installed, the :grep command may work<br>
well with the defaults. The syntax is very similar to the standard command:<br>
<br>
<div class="helpExample"> :grep foo *.c</div>
<br>
Will search all files with the .c extension for the substring "foo". The<br>
arguments to :grep are passed straight to the "grep" program, so you can use<br>
whatever options your "grep" supports.<br>
<br>
By default, :grep invokes grep with the -n option (show file and line<br>
numbers). You can change this with the <a class="Type" href="options.html#'grepprg'">'grepprg'</a> option. You will need to set<br>
<a class="Type" href="options.html#'grepprg'">'grepprg'</a> if:<br>
<br>
a) You are using a program that isn't called "grep"<br>
b) You have to call grep with a full path<br>
c) You want to pass other options automatically (e.g. case insensitive<br>
search.)<br>
<br>
Once "grep" has executed, Vim parses the results using the <a class="Type" href="options.html#'grepformat'">'grepformat'</a><br>
option. This option works in the same way as the <a class="Type" href="options.html#'errorformat'">'errorformat'</a> option - see<br>
that for details. You may need to change <a class="Type" href="options.html#'grepformat'">'grepformat'</a> from the default if<br>
your grep outputs in a non-standard format, or you are using some other<br>
program with a special format.<br>
<br>
Once the results are parsed, Vim loads the first file containing a match and<br>
jumps to the appropriate line, in the same way that it jumps to a compiler<br>
error in <a class="Identifier" href="quickfix.html#quickfix">quickfix</a> mode. You can then use the <a class="Identifier" href="quickfix.html#:cnext">:cnext</a>, <a class="Identifier" href="quickfix.html#:clist">:clist</a>, etc.<br>
commands to see the other matches.<br>
<br>
<br>
5.4 Using :grep with id-utils<br>
<br>
You can set up :grep to work with the GNU id-utils like this:<br>
<br>
<div class="helpExample"> :set grepprg=lid\ -Rgrep\ -s<br>
:set grepformat=%f:%l:%m</div>
<br>
then<br>
<div class="helpExample"> :grep (regexp)</div>
<br>
works just as you'd expect.<br>
(provided you remembered to mkid first :)<br>
<br>
<br>
5.5 Browsing source code with :vimgrep or :grep<br>
<br>
Using the stack of error lists that Vim keeps, you can browse your files to<br>
look for functions and the functions they call. For example, suppose that you<br>
have to add an argument to the read_file() function. You enter this command:<br>
<br>
<div class="helpExample"> :vimgrep /\<read_file\>/ *.c</div>
<br>
You use ":cn" to go along the list of matches and add the argument. At one<br>
place you have to get the new argument from a higher level function msg(), and<br>
need to change that one too. Thus you use:<br>
<br>
<div class="helpExample"> :vimgrep /\<msg\>/ *.c</div>
<br>
While changing the msg() functions, you find another function that needs to<br>
get the argument from a higher level. You can again use ":vimgrep" to find<br>
these functions. Once you are finished with one function, you can use<br>
<br>
<div class="helpExample"> :colder</div>
<br>
to go back to the previous one.<br>
<br>
This works like browsing a tree: ":vimgrep" goes one level deeper, creating a<br>
list of branches. ":colder" goes back to the previous level. You can mix<br>
this use of ":vimgrep" and "colder" to browse all the locations in a tree-like<br>
way. If you do this consistently, you will find all locations without the<br>
need to write down a "todo" list.<br>
<br>
<span class="PreProc">=============================================================================</span><br>
6. Selecting a compiler <a class="Constant" href="quickfix.html#compiler-select" name="compiler-select">compiler-select</a><br>
<br>
<a class="Constant" href="quickfix.html#:comp" name=":comp">:comp</a> <a class="Constant" href="quickfix.html#:compiler" name=":compiler">:compiler</a> <a class="Constant" href="quickfix.html#E666" name="E666">E666</a><br>
:comp[iler][!] <span class="Special">{name}</span> Set options to work with compiler <span class="Special">{name}</span>.<br>
Without the "!" options are set for the<br>
current buffer. With "!" global options are<br>
set.<br>
If you use ":compiler foo" in "file.foo" and<br>
then ":compiler! bar" in another buffer, Vim<br>
will keep on using "foo" in "file.foo".<br>
<span class="Special">{not available when compiled without the</span><br>
<a class="Identifier" href="various.html#+eval">+eval</a><span class="Special"> feature}</span><br>
<br>
<br>
The Vim plugins in the "compiler" directory will set options to use the<br>
selected compiler. For <a class="Comment" href="quickfix.html#:compiler">:compiler</a> local options are set, for <span class="Comment">:compiler!</span><br>
global options.<br>
<a class="Constant" href="quickfix.html#current_compiler" name="current_compiler">current_compiler</a><br>
To support older Vim versions, the plugins always use "current_compiler" and<br>
not "b:current_compiler". What the command actually does is the following:<br>
<br>
- Delete the "current_compiler" and "b:current_compiler" variables.<br>
- Define the "CompilerSet" user command. With "!" it does ":set", without "!"<br>
it does ":setlocal".<br>
- Execute ":runtime! compiler/<span class="Special">{name}</span>.vim". The plugins are expected to set<br>
options with "CompilerSet" and set the "current_compiler" variable to the<br>
name of the compiler.<br>
- Delete the "CompilerSet" user command.<br>
- Set "b:current_compiler" to the value of "current_compiler".<br>
- Without "!" the old value of "current_compiler" is restored.<br>
<br>
<br>
For writing a compiler plugin, see <a class="Identifier" href="usr_41.html#write-compiler-plugin">write-compiler-plugin</a>.<br>
<br>
<br>
<span class="Statement">GCC </span><a class="Constant" href="quickfix.html#quickfix-gcc" name="quickfix-gcc">quickfix-gcc</a> <a class="Constant" href="quickfix.html#compiler-gcc" name="compiler-gcc">compiler-gcc</a><br>
<br>
There's one variable you can set for the GCC compiler:<br>
<br>
g:compiler_gcc_ignore_unmatched_lines<br>
Ignore lines that don't match any patterns<br>
defined for GCC. Useful if output from<br>
commands run from make are generating false<br>
positives.<br>
<br>
<br>
<span class="Statement">MANX AZTEC C </span><a class="Constant" href="quickfix.html#quickfix-manx" name="quickfix-manx">quickfix-manx</a> <a class="Constant" href="quickfix.html#compiler-manx" name="compiler-manx">compiler-manx</a><br>
<br>
To use Vim with Manx's Aztec C compiler on the Amiga you should do the<br>
following:<br>
- Set the CCEDIT environment variable with the command:<br>
<div class="helpExample"> mset "CCEDIT=vim -q"</div>
- Compile with the -qf option. If the compiler finds any errors, Vim is<br>
started and the cursor is positioned on the first error. The error message<br>
will be displayed on the last line. You can go to other errors with the<br>
commands mentioned above. You can fix the errors and write the file(s).<br>
- If you exit Vim normally the compiler will re-compile the same file. If you<br>
exit with the :cq command, the compiler will terminate. Do this if you<br>
cannot fix the error, or if another file needs to be compiled first.<br>
<br>
There are some restrictions to the Quickfix mode on the Amiga. The<br>
compiler only writes the first 25 errors to the errorfile (Manx's<br>
documentation does not say how to get more). If you want to find the others,<br>
you will have to fix a few errors and exit the editor. After recompiling,<br>
up to 25 remaining errors will be found.<br>
<br>
If Vim was started from the compiler, the :sh and some :! commands will not<br>
work, because Vim is then running in the same process as the compiler and<br>
stdin (standard input) will not be interactive.<br>
<br>
<br>
<span class="Statement">PERL </span><a class="Constant" href="quickfix.html#quickfix-perl" name="quickfix-perl">quickfix-perl</a> <a class="Constant" href="quickfix.html#compiler-perl" name="compiler-perl">compiler-perl</a><br>
<br>
The Perl compiler plugin doesn't actually compile, but invokes Perl's internal<br>
syntax checking feature and parses the output for possible errors so you can<br>
correct them in quick-fix mode.<br>
<br>
Warnings are forced regardless of "no warnings" or "$^W = 0" within the file<br>
being checked. To disable this set g:perl_compiler_force_warnings to a zero<br>
value. For example:<br>
<div class="helpExample"> let g:perl_compiler_force_warnings = 0</div>
<br>
<br>
<span class="Statement">PYUNIT COMPILER </span><a class="Constant" href="quickfix.html#compiler-pyunit" name="compiler-pyunit">compiler-pyunit</a><br>
<br>
This is not actually a compiler, but a unit testing framework for the<br>
Python language. It is included into standard Python distribution<br>
starting from version 2.0. For older versions, you can get it from<br>
<span class="Constant"><a href="http://pyunit.sourceforge.net">http://pyunit.sourceforge.net</a></span>.<br>
<br>
When you run your tests with the help of the framework, possible errors<br>
are parsed by Vim and presented for you in quick-fix mode.<br>
<br>
Unfortunately, there is no standard way to run the tests.<br>
The alltests.py script seems to be used quite often, that's all.<br>
Useful values for the <a class="Type" href="options.html#'makeprg'">'makeprg'</a> options therefore are:<br>
setlocal makeprg=./alltests.py " Run a testsuite<br>
setlocal makeprg=python\ %:S " Run a single testcase<br>
<br>
Also see <span class="Constant"><a href="http://vim.sourceforge.net/tip_view.php?tip_id=280">http://vim.sourceforge.net/tip_view.php?tip_id=280</a></span>.<br>
<br>
<br>
<span class="Statement">TEX COMPILER </span><a class="Constant" href="quickfix.html#compiler-tex" name="compiler-tex">compiler-tex</a><br>
<br>
Included in the distribution compiler for TeX ($VIMRUNTIME/compiler/tex.vim)<br>
uses make command if possible. If the compiler finds a file named "Makefile"<br>
or "makefile" in the current directory, it supposes that you want to process<br>
your *TeX files with make, and the makefile does the right work. In this case<br>
compiler sets <a class="Type" href="options.html#'errorformat'">'errorformat'</a> for *TeX output and leaves <a class="Type" href="options.html#'makeprg'">'makeprg'</a> untouched. If<br>
neither "Makefile" nor "makefile" is found, the compiler will not use make.<br>
You can force the compiler to ignore makefiles by defining<br>
b:tex_ignore_makefile or g:tex_ignore_makefile variable (they are checked for<br>
existence only).<br>
<br>
If the compiler chose not to use make, it need to choose a right program for<br>
processing your input. If b:tex_flavor or g:tex_flavor (in this precedence)<br>
variable exists, it defines TeX flavor for :make (actually, this is the name<br>
of executed command), and if both variables do not exist, it defaults to<br>
"latex". For example, while editing chapter2.tex \input-ed from mypaper.tex<br>
written in AMS-TeX:<br>
<br>
<div class="helpExample"> :let b:tex_flavor = 'amstex'<br>
:compiler tex</div>
[editing...]<br>
<div class="helpExample"> :make mypaper</div>
<br>
<span class="Todo">Note</span> that you must specify a name of the file to process as an argument (to<br>
process the right file when editing \input-ed or \include-ed file; portable<br>
solution for substituting % for no arguments is welcome). This is not in the<br>
semantics of make, where you specify a target, not source, but you may specify<br>
filename without extension ".tex" and mean this as "make filename.dvi or<br>
filename.pdf or filename.some_result_extension according to compiler".<br>
<br>
<span class="Todo">Note</span>: tex command line syntax is set to usable both for MikTeX (suggestion<br>
by Srinath Avadhanula) and teTeX (checked by Artem Chuprina). Suggestion<br>
from <a class="Identifier" href="quickfix.html#errorformat-LaTeX">errorformat-LaTeX</a> is too complex to keep it working for different<br>
shells and OSes and also does not allow to use other available TeX options,<br>
if any. If your TeX doesn't support "-interaction=nonstopmode", please<br>
report it with different means to express \nonstopmode from the command line.<br>
<br>
<span class="PreProc">=============================================================================</span><br>
7. The error format <a class="Constant" href="quickfix.html#error-file-format" name="error-file-format">error-file-format</a><br>
<br>
<a class="Constant" href="quickfix.html#errorformat" name="errorformat">errorformat</a> <a class="Constant" href="quickfix.html#E372" name="E372">E372</a> <a class="Constant" href="quickfix.html#E373" name="E373">E373</a> <a class="Constant" href="quickfix.html#E374" name="E374">E374</a><br>
<a class="Constant" href="quickfix.html#E375" name="E375">E375</a> <a class="Constant" href="quickfix.html#E376" name="E376">E376</a> <a class="Constant" href="quickfix.html#E377" name="E377">E377</a> <a class="Constant" href="quickfix.html#E378" name="E378">E378</a><br>
The <a class="Type" href="options.html#'errorformat'">'errorformat'</a> option specifies a list of formats that are recognized. The<br>
first format that matches with an error message is used. You can add several<br>
formats for different messages your compiler produces, or even entries for<br>
multiple compilers. See <a class="Identifier" href="quickfix.html#efm-entries">efm-entries</a>.<br>
<br>
Each entry in <a class="Type" href="options.html#'errorformat'">'errorformat'</a> is a scanf-like string that describes the format.<br>
First, you need to know how scanf works. Look in the documentation of your<br>
C compiler. Below you find the % items that Vim understands. Others are<br>
invalid.<br>
<br>
Special characters in <a class="Type" href="options.html#'errorformat'">'errorformat'</a> are comma and backslash. See<br>
<a class="Identifier" href="quickfix.html#efm-entries">efm-entries</a> for how to deal with them. <span class="Todo">Note</span> that a literal "%" is matched<br>
by "%%", thus it is not escaped with a backslash.<br>
Keep in mind that in the <a class="Comment" href="quickfix.html#:make">:make</a> and <a class="Comment" href="quickfix.html#:grep">:grep</a> output all NUL characters are<br>
replaced with SOH (0x01).<br>
<br>
<span class="Todo">Note</span>: By default the difference between upper and lowercase is ignored. If<br>
you want to match case, add "\C" to the pattern <a class="Identifier" href="pattern.html#/\C">/\C</a>.<br>
<br>
<br>
Basic items<br>
<br>
%f file name (finds a string)<br>
%l line number (finds a number)<br>
%c column number (finds a number representing character<br>
column of the error, (1 <span class="Special"><tab></span> == 1 character column))<br>
%v virtual column number (finds a number representing<br>
screen column of the error (1 <span class="Special"><tab></span> == 8 screen<br>
columns))<br>
%t error type (finds a single character)<br>
%n error number (finds a number)<br>
%m error message (finds a string)<br>
%r matches the "rest" of a single-line file message %O/P/Q<br>
%p pointer line (finds a sequence of '-', '.', ' ' or<br>
tabs and uses the length for the column number)<br>
%*<span class="Special">{conv}</span> any scanf non-assignable conversion<br>
%% the single '%' character<br>
%s search text (finds a string)<br>
<br>
The "%f" conversion may depend on the current <a class="Type" href="options.html#'isfname'">'isfname'</a> setting. "~/" is<br>
expanded to the home directory and environment variables are expanded.<br>
<br>
The "%f" and "%m" conversions have to detect the end of the string. This<br>
normally happens by matching following characters and items. When nothing is<br>
following the rest of the line is matched. If "%f" is followed by a '%' or a<br>
backslash, it will look for a sequence of <a class="Type" href="options.html#'isfname'">'isfname'</a> characters.<br>
<br>
On MS-DOS, MS-Windows and OS/2 a leading "C:" will be included in "%f", even<br>
when using "%f:". This means that a file name which is a single alphabetical<br>
letter will not be detected.<br>
<br>
The "%p" conversion is normally followed by a "^". It's used for compilers<br>
that output a line like:<br>
<div class="helpExample"> ^</div>
or<br>
<div class="helpExample"> ---------^</div>
to indicate the column of the error. This is to be used in a multi-line error<br>
message. See <a class="Identifier" href="quickfix.html#errorformat-javac">errorformat-javac</a> for a useful example.<br>
<br>
The "%s" conversion specifies the text to search for to locate the error line.<br>
The text is used as a literal string. The anchors "^" and "$" are added to<br>
the text to locate the error line exactly matching the search text and the<br>
text is prefixed with the "\V" atom to make it "very nomagic". The "%s"<br>
conversion can be used to locate lines without a line number in the error<br>
output. Like the output of the "grep" shell command.<br>
When the pattern is present the line number will not be used.<br>
<br>
Changing directory<br>
<br>
The following uppercase conversion characters specify the type of special<br>
format strings. At most one of them may be given as a prefix at the begin<br>
of a single comma-separated format pattern.<br>
Some compilers produce messages that consist of directory names that have to<br>
be prepended to each file name read by %f (example: GNU make). The following<br>
codes can be used to scan these directory names; they will be stored in an<br>
internal directory stack. <a class="Constant" href="quickfix.html#E379" name="E379">E379</a><br>
%D "enter directory" format string; expects a following<br>
%f that finds the directory name<br>
%X "leave directory" format string; expects following %f<br>
<br>
When defining an "enter directory" or "leave directory" format, the "%D" or<br>
"%X" has to be given at the start of that substring. Vim tracks the directory<br>
changes and prepends the current directory to each erroneous file found with a<br>
relative path. See <a class="Identifier" href="quickfix.html#quickfix-directory-stack">quickfix-directory-stack</a> for details, tips and<br>
limitations.<br>
<br>
<br>
Multi-line messages <a class="Constant" href="quickfix.html#errorformat-multi-line" name="errorformat-multi-line">errorformat-multi-line</a><br>
<br>
It is possible to read the output of programs that produce multi-line<br>
messages, i.e. error strings that consume more than one line. Possible<br>
prefixes are:<br>
%E start of a multi-line error message<br>
%W start of a multi-line warning message<br>
%I start of a multi-line informational message<br>
%A start of a multi-line message (unspecified type)<br>
%> for next line start with current pattern again <a class="Identifier" href="quickfix.html#efm-%>">efm-%></a><br>
%C continuation of a multi-line message<br>
%Z end of a multi-line message<br>
These can be used with '+' and '-', see <a class="Identifier" href="quickfix.html#efm-ignore">efm-ignore</a> below.<br>
<br>
Using "\n" in the pattern won't work to match multi-line messages.<br>
<br>
Example: Your compiler happens to write out errors in the following format<br>
(leading line numbers not being part of the actual output):<br>
<br>
<span class="PreProc">1 Error 275</span><br>
<span class="PreProc">2 line 42</span><br>
<span class="PreProc">3 column 3</span><br>
<span class="PreProc">4 ' ' expected after '--'</span><br>
<br>
The appropriate error format string has to look like this:<br>
<div class="helpExample"> :set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m</div>
<br>
And the <a class="Identifier" href="quickfix.html#:clist">:clist</a> error message generated for this error is:<br>
<br>
1:42 col 3 error 275: ' ' expected after '--'<br>
<br>
Another example: Think of a Python interpreter that produces the following<br>
error message (line numbers are not part of the actual output):<br>
<br>
1 ==============================================================<br>
2 FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest)<br>
3 --------------------------------------------------------------<br>
4 Traceback (most recent call last):<br>
5 File "unittests/dbfacadeTest.py", line 89, in testFoo<br>
6 self.assertEquals(34, dtid)<br>
7 File "/usr/lib/python2.2/unittest.py", line 286, in<br>
8 failUnlessEqual<br>
9 raise self.failureException, \<br>
10 AssertionError: 34 != 33<br>
11<br>
12 --------------------------------------------------------------<br>
13 Ran 27 tests in 0.063s<br>
<br>
Say you want <a class="Identifier" href="quickfix.html#:clist">:clist</a> write the relevant information of this message only,<br>
namely:<br>
5 unittests/dbfacadeTest.py:89: AssertionError: 34 != 33<br>
<br>
Then the error format string could be defined as follows:<br>
<div class="helpExample"> :set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m</div>
<br>
<span class="Todo">Note</span> that the %C string is given before the %A here: since the expression<br>
' %.%#' (which stands for the regular expression ' .*') matches every line<br>
starting with a space, followed by any characters to the end of the line,<br>
it also hides line 7 which would trigger a separate error message otherwise.<br>
Error format strings are always parsed pattern by pattern until the first<br>
match occurs.<br>
<a class="Constant" href="quickfix.html#efm-%>" name="efm-%>">efm-%></a><br>
The %> item can be used to avoid trying patterns that appear earlier in<br>
<a class="Type" href="options.html#'errorformat'">'errorformat'</a>. This is useful for patterns that match just about anything.<br>
For example, if the error looks like this:<br>
<br>
<span class="PreProc">Error in line 123 of foo.c:</span><br>
<span class="PreProc">unknown variable "i"</span><br>
<br>
This can be found with:<br>
<div class="helpExample"> :set efm=xxx,%E%>Error in line %l of %f:,%Z%m</div>
Where "xxx" has a pattern that would also match the second line.<br>
<br>
Important: There is no memory of what part of the errorformat matched before;<br>
every line in the error file gets a complete new run through the error format<br>
lines. For example, if one has:<br>
<div class="helpExample"> setlocal efm=aa,bb,cc,dd,ee</div>
Where aa, bb, etc. are error format strings. Each line of the error file will<br>
be matched to the pattern aa, then bb, then cc, etc. Just because cc matched<br>
the previous error line does _not_ mean that dd will be tried first on the<br>
current line, even if cc and dd are multi-line errorformat strings.<br>
<br>
<br>
<br>
Separate file name <a class="Constant" href="quickfix.html#errorformat-separate-filename" name="errorformat-separate-filename">errorformat-separate-filename</a><br>
<br>
These prefixes are useful if the file name is given once and multiple messages<br>
follow that refer to this file name.<br>
%O single-line file message: overread the matched part<br>
%P single-line file message: push file %f onto the stack<br>
%Q single-line file message: pop the last file from stack<br>
<br>
Example: Given a compiler that produces the following error logfile (without<br>
leading line numbers):<br>
<br>
1 [a1.tt]<br>
2 (1,17) error: ';' missing<br>
3 (21,2) warning: variable 'z' not defined<br>
4 (67,3) error: end of file found before string ended<br>
5<br>
6 [a2.tt]<br>
7<br>
8 [a3.tt]<br>
9 NEW compiler v1.1<br>
10 (2,2) warning: variable 'x' not defined<br>
11 (67,3) warning: 's' already defined<br>
<br>
This logfile lists several messages for each file enclosed in [...] which are<br>
properly parsed by an error format like this:<br>
<div class="helpExample"> :set efm=%+P[%f],(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%-Q</div>
<br>
A call of <a class="Identifier" href="quickfix.html#:clist">:clist</a> writes them accordingly with their correct filenames:<br>
<br>
2 a1.tt:1 col 17 error: ';' missing<br>
3 a1.tt:21 col 2 warning: variable 'z' not defined<br>
4 a1.tt:67 col 3 error: end of file found before string ended<br>
8 a3.tt:2 col 2 warning: variable 'x' not defined<br>
9 a3.tt:67 col 3 warning: 's' already defined<br>
<br>
Unlike the other prefixes that all match against whole lines, %P, %Q and %O<br>
can be used to match several patterns in the same line. Thus it is possible<br>
to parse even nested files like in the following line:<br>
{"file1" {"file2" error1} error2 {"file3" error3 {"file4" error4 error5}}}<br>
The %O then parses over strings that do not contain any push/pop file name<br>
information. See <a class="Identifier" href="quickfix.html#errorformat-LaTeX">errorformat-LaTeX</a> for an extended example.<br>
<br>
<br>
Ignoring and using whole messages <a class="Constant" href="quickfix.html#efm-ignore" name="efm-ignore">efm-ignore</a><br>
<br>
The codes '+' or '-' can be combined with the uppercase codes above; in that<br>
case they have to precede the letter, e.g. '%+A' or '%-G':<br>
%- do not include the matching multi-line in any output<br>
%+ include the whole matching line in the %m error string<br>
<br>
One prefix is only useful in combination with '+' or '-', namely %G. It parses<br>
over lines containing general information like compiler version strings or<br>
other headers that can be skipped.<br>
%-G ignore this message<br>
%+G general message<br>
<br>
<br>
Pattern matching<br>
<br>
The scanf()-like "%*[]" notation is supported for backward-compatibility<br>
with previous versions of Vim. However, it is also possible to specify<br>
(nearly) any Vim supported regular expression in format strings.<br>
Since meta characters of the regular expression language can be part of<br>
ordinary matching strings or file names (and therefore internally have to<br>
be escaped), meta symbols have to be written with leading '%':<br>
%\ The single '\' character. <span class="Todo">Note</span> that this has to be<br>
escaped ("%\\") in ":set errorformat=" definitions.<br>
%. The single '.' character.<br>
%# The single '*'(!) character.<br>
%^ The single '^' character. <span class="Todo">Note</span> that this is not<br>
useful, the pattern already matches start of line.<br>
%$ The single '$' character. <span class="Todo">Note</span> that this is not<br>
useful, the pattern already matches end of line.<br>
%[ The single '[' character for a [] character range.<br>
%~ The single '~' character.<br>
When using character classes in expressions (see <a class="Identifier" href="pattern.html#/\i">/\i</a> for an overview),<br>
terms containing the "\+" quantifier can be written in the scanf() "%*"<br>
notation. Example: "%\\d%\\+" ("\d\+", "any number") is equivalent to "%*\\d".<br>
Important <span class="Todo">note</span>: The \(...\) grouping of sub-matches can not be used in format<br>
specifications because it is reserved for internal conversions.<br>
<br>
<br>
Multiple entries in <a class="Type" href="options.html#'errorformat'">'errorformat'</a> <a class="Constant" href="quickfix.html#efm-entries" name="efm-entries">efm-entries</a><br>
<br>
To be able to detect output from several compilers, several format patterns<br>
may be put in <a class="Type" href="options.html#'errorformat'">'errorformat'</a>, separated by commas (<span class="Todo">note</span>: blanks after the comma<br>
are ignored). The first pattern that has a complete match is used. If no<br>
match is found, matching parts from the last one will be used, although the<br>
file name is removed and the error message is set to the whole message. If<br>
there is a pattern that may match output from several compilers (but not in a<br>
right way), put it after one that is more restrictive.<br>
<br>
To include a comma in a pattern precede it with a backslash (you have to type<br>
two in a ":set" command). To include a backslash itself give two backslashes<br>
(you have to type four in a ":set" command). You also need to put a backslash<br>
before a space for ":set".<br>
<br>
<br>
Valid matches <a class="Constant" href="quickfix.html#quickfix-valid" name="quickfix-valid">quickfix-valid</a><br>
<br>
If a line does not completely match one of the entries in <a class="Type" href="options.html#'errorformat'">'errorformat'</a>, the<br>
whole line is put in the error message and the entry is marked "not valid"<br>
These lines are skipped with the ":cn" and ":cp" commands (unless there is<br>
no valid line at all). You can use ":cl!" to display all the error messages.<br>
<br>
If the error format does not contain a file name Vim cannot switch to the<br>
correct file. You will have to do this by hand.<br>
<br>
<br>
Examples<br>
<br>
The format of the file from the Amiga Aztec compiler is:<br>
<br>
filename>linenumber:columnnumber:errortype:errornumber:errormessage<br>
<br>
filename name of the file in which the error was detected<br>
linenumber line number where the error was detected<br>
columnnumber column number where the error was detected<br>
errortype type of the error, normally a single 'E' or 'W'<br>
errornumber number of the error (for lookup in the manual)<br>
errormessage description of the error<br>
<br>
This can be matched with this <a class="Type" href="options.html#'errorformat'">'errorformat'</a> entry:<br>
%f>%l:%c:%t:%n:%m<br>
<br>
Some examples for C compilers that produce single-line error outputs:<br>
%f:%l:\ %t%*[^0123456789]%n:\ %m for Manx/Aztec C error messages<br>
(scanf() doesn't understand <span class="Special">[0-9]</span>)<br>
%f\ %l\ %t%*[^0-9]%n:\ %m for SAS C<br>
\"%f\"\\,%*[^0-9]%l:\ %m for generic C compilers<br>
%f:%l:\ %m for GCC<br>
%f:%l:\ %m,%Dgmake[%*\\d]:\ Entering\ directory\ `%f',<br>
%Dgmake[%*\\d]:\ Leaving\ directory\ `%f'<br>
for GCC with gmake (concat the lines!)<br>
%f(%l)\ :\ %*[^:]:\ %m old SCO C compiler (pre-OS5)<br>
%f(%l)\ :\ %t%*[^0-9]%n:\ %m idem, with error type and number<br>
%f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m<br>
for GCC, with some extras<br>
<br>
Extended examples for the handling of multi-line messages are given below,<br>
see <a class="Identifier" href="quickfix.html#errorformat-Jikes">errorformat-Jikes</a> and <a class="Identifier" href="quickfix.html#errorformat-LaTeX">errorformat-LaTeX</a>.<br>
<br>
<span class="Todo">Note</span> the backslash in front of a space and double quote. It is required for<br>
the :set command. There are two backslashes in front of a comma, one for the<br>
:set command and one to avoid recognizing the comma as a separator of error<br>
formats.<br>
<br>
<br>
Filtering messages<br>
<br>
If you have a compiler that produces error messages that do not fit in the<br>
format string, you could write a program that translates the error messages<br>
into this format. You can use this program with the ":make" command by<br>
changing the <a class="Type" href="options.html#'makeprg'">'makeprg'</a> option. For example:<br>
<div class="helpExample"> :set mp=make\ \\\|&\ error_filter</div>
The backslashes before the pipe character are required to avoid it to be<br>
recognized as a command separator. The backslash before each space is<br>
required for the set command.<br>
<br>
<span class="PreProc">=============================================================================</span><br>
8. The directory stack <a class="Constant" href="quickfix.html#quickfix-directory-stack" name="quickfix-directory-stack">quickfix-directory-stack</a><br>
<br>
Quickfix maintains a stack for saving all used directories parsed from the<br>
make output. For GNU-make this is rather simple, as it always prints the<br>
absolute path of all directories it enters and leaves. Regardless if this is<br>
done via a <a class="Type" href="options.html#'cd'">'cd'</a> command in the makefile or with the parameter "-C dir" (change<br>
to directory before reading the makefile). It may be useful to use the switch<br>
"-w" to force GNU-make to print out the working directory before and after<br>
processing.<br>
<br>
Maintaining the correct directory is more complicated if you don't use<br>
GNU-make. AIX-make for example doesn't print any information about its<br>
working directory. Then you need to enhance the makefile. In the makefile of<br>
LessTif there is a command which echoes "Making <span class="Special">{target}</span> in <span class="Special">{dir}</span>". The<br>
special problem here is that it doesn't print information on leaving the<br>
directory and that it doesn't print the absolute path.<br>
<br>
To solve the problem with relative paths and missing "leave directory"<br>
messages Vim uses following algorithm:<br>
<br>
1) Check if the given directory is a subdirectory of the current directory.<br>
If this is true, store it as the current directory.<br>
2) If it is not a subdir of the current directory, try if this is a<br>
subdirectory of one of the upper directories.<br>
3) If the directory still isn't found, it is assumed to be a subdirectory<br>
of Vim's current directory.<br>
<br>
Additionally it is checked for every file, if it really exists in the<br>
identified directory. If not, it is searched in all other directories of the<br>
directory stack (NOT the directory subtree!). If it is still not found, it is<br>
assumed that it is in Vim's current directory.<br>
<br>
There are limitations in this algorithm. These examples assume that make just<br>
prints information about entering a directory in the form "Making all in dir".<br>
<br>
1) Assume you have following directories and files:<br>
./dir1<br>
./dir1/file1.c<br>
./file1.c<br>
<br>
If make processes the directory "./dir1" before the current directory and<br>
there is an error in the file "./file1.c", you will end up with the file<br>
"./dir1/file.c" loaded by Vim.<br>
<br>
This can only be solved with a "leave directory" message.<br>
<br>
2) Assume you have following directories and files:<br>
./dir1<br>
./dir1/dir2<br>
./dir2<br>
<br>
You get the following:<br>
<br>
Make output Directory interpreted by Vim<br>
------------------------ ----------------------------<br>
Making all in dir1 ./dir1<br>
Making all in dir2 ./dir1/dir2<br>
Making all in dir2 ./dir1/dir2<br>
<br>
This can be solved by printing absolute directories in the "enter directory"<br>
message or by printing "leave directory" messages.<br>
<br>
To avoid this problem, ensure to print absolute directory names and "leave<br>
directory" messages.<br>
<br>
Examples for Makefiles:<br>
<br>
Unix:<br>
libs:<br>
for dn in $(LIBDIRS); do \<br>
(cd $$dn; echo "Entering dir '$$(pwd)'"; make); \<br>
echo "Leaving dir"; \<br>
done<br>
<br>
Add<br>
%DEntering\ dir\ '%f',%XLeaving\ dir<br>
to your <a class="Type" href="options.html#'errorformat'">'errorformat'</a> to handle the above output.<br>
<br>
<span class="Todo">Note</span> that Vim doesn't check if the directory name in a "leave directory"<br>
messages is the current directory. This is why you could just use the message<br>
"Leaving dir".<br>
<br>
<span class="PreProc">=============================================================================</span><br>
9. Specific error file formats <a class="Constant" href="quickfix.html#errorformats" name="errorformats">errorformats</a><br>
<br>
<a class="Constant" href="quickfix.html#errorformat-Jikes" name="errorformat-Jikes">errorformat-Jikes</a><br>
Jikes(TM), a source-to-bytecode Java compiler published by IBM Research,<br>
produces simple multi-line error messages.<br>
<br>
An <a class="Type" href="options.html#'errorformat'">'errorformat'</a> string matching the produced messages is shown below.<br>
The following lines can be placed in the user's <a class="Identifier" href="starting.html#vimrc">vimrc</a> to overwrite Vim's<br>
recognized default formats, or see <a class="Identifier" href="options.html#:set+=">:set+=</a> how to install this format<br>
additionally to the default.<br>
<br>
<div class="helpExample"> :set efm=%A%f:%l:%c:%*\\d:%*\\d:,<br>
\%C%*\\s%trror:%m,<br>
\%+C%*[^:]%trror:%m,<br>
\%C%*\\s%tarning:%m,<br>
\%C%m</div>
<br>
Jikes(TM) produces a single-line error message when invoked with the option<br>
"+E", and can be matched with the following:<br>
<br>
<div class="helpExample"> :setl efm=%f:%l:%v:%*\\d:%*\\d:%*\\s%m</div>
<br>
<a class="Constant" href="quickfix.html#errorformat-javac" name="errorformat-javac">errorformat-javac</a><br>
This <a class="Type" href="options.html#'errorformat'">'errorformat'</a> has been reported to work well for javac, which outputs a<br>
line with "^" to indicate the column of the error:<br>
<div class="helpExample"> :setl efm=%A%f:%l:\ %m,%-Z%p^,%-C%.%#</div>
or:<br>
<div class="helpExample"> :setl efm=%A%f:%l:\ %m,%+Z%p^,%+C%.%#,%-G%.%#</div>
<br>
Here is an alternative from Michael F. Lamb for Unix that filters the errors<br>
first:<br>
<div class="helpExample"> :setl errorformat=%Z%f:%l:\ %m,%A%p^,%-G%*[^sl]%.%#<br>
:setl makeprg=javac\ %:S\ 2>&1\ \\\|\ vim-javac-filter</div>
<br>
You need to put the following in "vim-javac-filter" somewhere in your path<br>
(e.g., in ~/bin) and make it executable:<br>
<div class="helpExample"> #!/bin/sed -f<br>
/\^$/s/\t/\ /g;/:[0-9]\+:/{h;d};/^[ \t]*\^/G;</div>
<br>
In English, that sed script:<br>
- Changes single tabs to single spaces and<br>
- Moves the line with the filename, line number, error message to just after<br>
the pointer line. That way, the unused error text between doesn't break<br>
vim's notion of a "multi-line message" and also doesn't force us to include<br>
it as a "continuation of a multi-line message."<br>
<br>
<a class="Constant" href="quickfix.html#errorformat-ant" name="errorformat-ant">errorformat-ant</a><br>
For ant (<span class="Constant"><a href="http://jakarta.apache.org/">http://jakarta.apache.org/</a></span>) the above errorformat has to be modified<br>
to honour the leading <span class="Special">[javac]</span> in front of each javac output line:<br>
<div class="helpExample"> :set efm=%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#</div>
<br>
The <a class="Type" href="options.html#'errorformat'">'errorformat'</a> can also be configured to handle ant together with either<br>
javac or jikes. If you're using jikes, you should tell ant to use jikes' +E<br>
command line switch which forces jikes to generate one-line error messages.<br>
This is what the second line (of a build.xml file) below does:<br>
<div class="helpExample"> <property name = "build.compiler" value = "jikes"/><br>
<property name = "build.compiler.emacs" value = "true"/></div>
<br>
The <a class="Type" href="options.html#'errorformat'">'errorformat'</a> which handles ant with both javac and jikes is:<br>
<div class="helpExample"> :set efm=\ %#[javac]\ %#%f:%l:%c:%*\\d:%*\\d:\ %t%[%^:]%#:%m,<br>
\%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#</div>
<br>
<a class="Constant" href="quickfix.html#errorformat-jade" name="errorformat-jade">errorformat-jade</a><br>
parsing jade (see <span class="Constant"><a href="http://www.jclark.com/">http://www.jclark.com/</a></span>) errors is simple:<br>
<div class="helpExample"> :set efm=jade:%f:%l:%c:%t:%m</div>
<br>
<a class="Constant" href="quickfix.html#errorformat-LaTeX" name="errorformat-LaTeX">errorformat-LaTeX</a><br>
The following is an example how an <a class="Type" href="options.html#'errorformat'">'errorformat'</a> string can be specified<br>
for the (La)TeX typesetting system which displays error messages over<br>
multiple lines. The output of ":clist" and ":cc" etc. commands displays<br>
multi-lines in a single line, leading white space is removed.<br>
It should be easy to adopt the above LaTeX errorformat to any compiler output<br>
consisting of multi-line errors.<br>
<br>
The commands can be placed in a <a class="Identifier" href="starting.html#vimrc">vimrc</a> file or some other Vim script file,<br>
e.g. a script containing LaTeX related stuff which is loaded only when editing<br>
LaTeX sources.<br>
Make sure to copy all lines of the example (in the given order), afterwards<br>
remove the comment lines. For the '\' notation at the start of some lines see<br>
<a class="Identifier" href="repeat.html#line-continuation">line-continuation</a>.<br>
<br>
First prepare <a class="Type" href="options.html#'makeprg'">'makeprg'</a> such that LaTeX will report multiple<br>
errors; do not stop when the first error has occurred:<br>
<div class="helpExample"> :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}</div>
<br>
Start of multi-line error messages:<br>
<div class="helpExample"> :set efm=%E!\ LaTeX\ %trror:\ %m,<br>
\%E!\ %m,</div>
Start of multi-line warning messages; the first two also<br>
include the line number. Meaning of some regular expressions:<br>
- "%.%#" (".*") matches a (possibly empty) string<br>
- "%*\\d" ("\d\+") matches a number<br>
<div class="helpExample"> \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,<br>
\%+W%.%#\ at\ lines\ %l--%*\\d,<br>
\%WLaTeX\ %.%#Warning:\ %m,</div>
Possible continuations of error/warning messages; the first<br>
one also includes the line number:<br>
<div class="helpExample"> \%Cl.%l\ %m,<br>
\%+C\ \ %m.,<br>
\%+C%.%#-%.%#,<br>
\%+C%.%#[]%.%#,<br>
\%+C[]%.%#,<br>
\%+C%.%#%[{}\\]%.%#,<br>
\%+C<%.%#>%.%#,<br>
\%C\ \ %m,</div>
Lines that match the following patterns do not contain any<br>
important information; do not include them in messages:<br>
<div class="helpExample"> \%-GSee\ the\ LaTeX%m,<br>
\%-GType\ \ H\ <return>%m,<br>
\%-G\ ...%.%#,<br>
\%-G%.%#\ (C)\ %.%#,<br>
\%-G(see\ the\ transcript%.%#),</div>
Generally exclude any empty or whitespace-only line from<br>
being displayed:<br>
<div class="helpExample"> \%-G\\s%#,</div>
The LaTeX output log does not specify the names of erroneous<br>
source files per line; rather they are given globally,<br>
enclosed in parentheses.<br>
The following patterns try to match these names and store<br>
them in an internal stack. The patterns possibly scan over<br>
the same input line (one after another), the trailing "%r"<br>
conversion indicates the "rest" of the line that will be<br>
parsed in the next go until the end of line is reached.<br>
<br>
Overread a file name enclosed in '('...')'; do not push it<br>
on a stack since the file apparently does not contain any<br>
error:<br>
<div class="helpExample"> \%+O(%f)%r,</div>
Push a file name onto the stack. The name is given after '(':<br>
<div class="helpExample"> \%+P(%f%r,<br>
\%+P\ %\\=(%f%r,<br>
\%+P%*[^()](%f%r,<br>
\%+P[%\\d%[^()]%#(%f%r,</div>
Pop the last stored file name when a ')' is scanned:<br>
<div class="helpExample"> \%+Q)%r,<br>
\%+Q%*[^()])%r,<br>
\%+Q[%\\d%*[^()])%r</div>
<br>
<span class="Todo">Note</span> that in some cases file names in the LaTeX output log cannot be parsed<br>
properly. The parser might have been messed up by unbalanced parentheses<br>
then. The above example tries to catch the most relevant cases only.<br>
You can customize the given setting to suit your own purposes, for example,<br>
all the annoying "Overfull ..." warnings could be excluded from being<br>
recognized as an error.<br>
Alternatively to filtering the LaTeX compiler output, it is also possible<br>
to directly read the *.log file that is produced by the <span class="Special">[La]</span>TeX compiler.<br>
This contains even more useful information about possible error causes.<br>
However, to properly parse such a complex file, an external filter should<br>
be used. See the description further above how to make such a filter known<br>
by Vim.<br>
<br>
<a class="Constant" href="quickfix.html#errorformat-Perl" name="errorformat-Perl">errorformat-Perl</a><br>
In $VIMRUNTIME/tools you can find the efm_perl.pl script, which filters Perl<br>
error messages into a format that quickfix mode will understand. See the<br>
start of the file about how to use it. (This script is deprecated, see<br>
<a class="Identifier" href="quickfix.html#compiler-perl">compiler-perl</a>.)<br>
<br>
<br>
<br>
vim:tw=78:ts=8:ft=help:norl:<br>
</div>
</article>
<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>
<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->
</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。