41
|
1 *quickfix.txt* For Vim version 7.0aa. Last change: 2004 Dec 27
|
7
|
2
|
|
3
|
|
4 VIM REFERENCE MANUAL by Bram Moolenaar
|
|
5
|
|
6
|
|
7 This subject is introduced in section |30.1| of the user manual.
|
|
8
|
|
9 1. Using QuickFix commands |quickfix|
|
|
10 2. The error window |quickfix-window|
|
|
11 3. Using more than one list of errors |quickfix-error-lists|
|
|
12 4. Using :make |:make_makeprg|
|
|
13 5. Using :grep |grep|
|
|
14 6. Selecting a compiler |compiler-select|
|
|
15 7. The error format |error-file-format|
|
|
16 8. The directory stack |quickfix-directory-stack|
|
|
17 9. Specific error file formats |errorformats|
|
|
18
|
|
19 {Vi does not have any of these commands}
|
|
20
|
|
21 The quickfix commands are not available when the |+quickfix| feature was
|
|
22 disabled at compile time.
|
|
23
|
|
24 =============================================================================
|
|
25 1. Using QuickFix commands *quickfix* *Quickfix* *E42*
|
|
26
|
|
27 Vim has a special mode to speedup the edit-compile-edit cycle. This is
|
|
28 inspired by the quickfix option of the Manx's Aztec C compiler on the Amiga.
|
|
29 The idea is to save the error messages from the compiler in a file and use Vim
|
|
30 to jump to the errors one by one. You can examine each problem and fix it,
|
|
31 without having to remember all the error messages.
|
|
32
|
|
33 If you are using Manx's Aztec C compiler on the Amiga look here for how to use
|
|
34 it with Vim: |quickfix-manx|. If you are using another compiler you should
|
|
35 save the error messages in a file and start Vim with "vim -q filename". An
|
|
36 easy way to do this is with the |:make| command (see below). The
|
|
37 'errorformat' option should be set to match the error messages from your
|
|
38 compiler (see |errorformat| below).
|
|
39
|
|
40 The following quickfix commands can be used:
|
|
41
|
|
42 *:cc*
|
|
43 :cc[!] [nr] Display error [nr]. If [nr] is omitted, the same
|
|
44 error is displayed again. Without [!] this doesn't
|
|
45 work when jumping to another buffer, the current buffer
|
|
46 has been changed, there is the only window for the
|
|
47 buffer and both 'hidden' and 'autowrite' are off.
|
|
48 When jumping to another buffer with [!] any changes to
|
|
49 the current buffer are lost, unless 'hidden' is set or
|
|
50 there is another window for this buffer.
|
|
51 The 'switchbuf' settings are respected when jumping
|
|
52 to a buffer.
|
|
53
|
|
54 *:cn* *:cnext* *E553*
|
|
55 :[count]cn[ext][!] Display the [count] next error in the list that
|
|
56 includes a file name. If there are no file names at
|
|
57 all, go to the [count] next error. See |:cc| for
|
|
58 [!] and 'switchbuf'.
|
|
59
|
|
60 :[count]cN[ext][!] *:cp* *:cprevious* *:cN* *:cNext*
|
|
61 :[count]cp[revious][!] Display the [count] previous error in the list that
|
|
62 includes a file name. If there are no file names at
|
|
63 all, go to the [count] previous error. See |:cc| for
|
|
64 [!] and 'switchbuf'.
|
|
65
|
|
66 *:cnf* *:cnfile*
|
|
67 :[count]cnf[ile][!] Display the first error in the [count] next file in
|
|
68 the list that includes a file name. If there are no
|
|
69 file names at all or if there is no next file, go to
|
|
70 the [count] next error. See |:cc| for [!] and
|
|
71 'switchbuf'.
|
|
72
|
|
73 :[count]cNf[ile][!] *:cpf* *:cpfile* *:cNf* *:cNfile*
|
|
74 :[count]cpf[ile][!] Display the last error in the [count] previous file in
|
|
75 the list that includes a file name. If there are no
|
|
76 file names at all or if there is no next file, go to
|
|
77 the [count] previous error. See |:cc| for [!] and
|
|
78 'switchbuf'.
|
|
79
|
|
80 *:crewind* *:cr*
|
|
81 :cr[ewind][!] [nr] Display error [nr]. If [nr] is omitted, the FIRST
|
|
82 error is displayed. See |:cc|.
|
|
83
|
|
84 *:cfirst* *:cfir*
|
|
85 :cfir[st][!] [nr] Same as ":crewind".
|
|
86
|
|
87 *:clast* *:cla*
|
|
88 :cla[st][!] [nr] Display error [nr]. If [nr] is omitted, the LAST
|
|
89 error is displayed. See |:cc|.
|
|
90
|
|
91 *:cq* *:cquit*
|
|
92 :cq[uit] Quit Vim with an error code, so that the compiler
|
|
93 will not compile the same file again.
|
|
94
|
|
95 *:cf* *:cfile*
|
|
96 :cf[ile][!] [errorfile] Read the error file and jump to the first error.
|
|
97 This is done automatically when Vim is started with
|
|
98 the -q option. You can use this command when you
|
|
99 keep Vim running while compiling. If you give the
|
|
100 name of the errorfile, the 'errorfile' option will
|
|
101 be set to [errorfile]. See |:cc| for [!].
|
|
102
|
|
103 *:cg* *:cgetfile*
|
|
104 :cg[etfile][!] [errorfile]
|
|
105 Read the error file. Just like ":cfile" but don't
|
|
106 jump to the first error.
|
|
107
|
41
|
108 *:cb* *:cbuffer* *E681*
|
|
109 :cb[uffer] [bufnr] Read the error list from the current buffer.
|
|
110 When [bufnr] is given it must be the number of a
|
|
111 loaded buffer. That buffer will then be used instead
|
|
112 of the current buffer.
|
|
113 A range can be specified for the lines to be used.
|
|
114 Otherwise all lines in the buffer are used.
|
|
115
|
7
|
116 *:cl* *:clist*
|
|
117 :cl[ist] [from] [, [to]]
|
|
118 List all errors that are valid |quickfix-valid|.
|
|
119 If numbers [from] and/or [to] are given, the respective
|
|
120 range of errors is listed. A negative number counts
|
|
121 from the last error backwards, -1 being the last error.
|
|
122 The 'switchbuf' settings are respected when jumping
|
|
123 to a buffer.
|
|
124
|
|
125 :cl[ist]! [from] [, [to]]
|
|
126 List all errors.
|
|
127
|
|
128 If you insert or delete lines, mostly the correct error location is still
|
|
129 found because hidden marks are used. Sometimes, when the mark has been
|
|
130 deleted for some reason, the message "line changed" is shown to warn you that
|
|
131 the error location may not be correct. If you quit Vim and start again the
|
|
132 marks are lost and the error locations may not be correct anymore.
|
|
133
|
|
134 =============================================================================
|
|
135 2. The error window *quickfix-window*
|
|
136
|
|
137 *:cope* *:copen*
|
|
138 :cope[n] [height] Open a window to show the current list of errors.
|
|
139 When [height] is given, the window becomes that high
|
|
140 (if there is room). Otherwise the window is made ten
|
|
141 lines high.
|
|
142 The window will contain a special buffer, with
|
|
143 'buftype' equal to "quickfix". Don't change this!
|
|
144 If there already is a quickfix window, it will be made
|
|
145 the current window. It is not possible to open a
|
|
146 second quickfix window.
|
|
147
|
|
148 *:ccl* *:cclose*
|
|
149 :ccl[ose] Close the quickfix window.
|
|
150
|
|
151 *:cw* *:cwindow*
|
|
152 :cw[indow] [height] Open the quickfix window when there are recognized
|
|
153 errors. If the window is already open and there are
|
|
154 no recognized errors, close the window.
|
|
155
|
|
156
|
|
157 Normally the quickfix window is at the bottom of the screen. If there are
|
|
158 vertical splits, it's at the bottom of the rightmost column of windows. To
|
|
159 make it always occupy the full width: >
|
|
160 :botright cwindow
|
|
161 You can move the window around with |window-moving| commands.
|
|
162 For example, to move it to the top: CTRL-W K
|
|
163 The 'winfixheight' option will be set, which means that the window will mostly
|
|
164 keep its height, ignoring 'winheight' and 'equalalways'. You can change the
|
|
165 height manually (e.g., by dragging the status line above it with the mouse).
|
|
166
|
|
167 In the quickfix window, each line is one error. The line number is equal to
|
|
168 the error number. You can use ":.cc" to jump to the error under the cursor.
|
|
169 Hitting the <CR> key or double-clicking the mouse on a line has the same
|
|
170 effect. The file containing the error is opened in the window above the
|
|
171 quickfix window. If there already is a window for that file, it is used
|
|
172 instead. If the buffer in the used window has changed, and the error is in
|
|
173 another file, jumping to the error will fail. You will first have to make
|
|
174 sure the window contains a buffer which can be abandoned.
|
|
175
|
|
176 When the quickfix window has been filled, two autocommand events are
|
|
177 triggered. First the 'filetype' option is set to "qf", which triggers the
|
|
178 FileType event. Then the BufReadPost event is triggered. This can be used to
|
|
179 perform some action on the listed errors. Example: >
|
|
180 au BufReadPost quickfix setlocal nomodifiable
|
|
181 \ | silent g/^/s//\=line(".")." "/
|
|
182 \ | setlocal modifiable
|
|
183 This prepends the line number to each line. Note the use of "\=" in the
|
|
184 substitute string of the ":s" command, which is used to evaluate an
|
|
185 expression.
|
|
186
|
|
187 Note: Making changes in the quickfix window has no effect on the list of
|
|
188 errors. 'modifiable' is off to avoid making changes. If you delete or insert
|
|
189 lines anyway, the relation between the text and the error number is messed up.
|
|
190 If you really want to do this, you could write the contents of the quickfix
|
|
191 window to a file and use ":cfile" to have it parsed and used as the new error
|
|
192 list.
|
|
193
|
|
194 =============================================================================
|
|
195 3. Using more than one list of errors *quickfix-error-lists*
|
|
196
|
|
197 So far has been assumed that there is only one list of errors. Actually the
|
|
198 ten last used lists are remembered. When starting a new list, the previous
|
|
199 ones are automatically kept. Two commands can be used to access older error
|
|
200 lists. They set one of the existing error lists as the current one.
|
|
201
|
|
202 *:colder* *:col* *E380*
|
|
203 :col[der] [count] Go to older error list. When [count] is given, do
|
|
204 this [count] times. When already at the oldest error
|
|
205 list, an error message is given.
|
|
206
|
|
207 *:cnewer* *:cnew* *E381*
|
|
208 :cnew[er] [count] Go to newer error list. When [count] is given, do
|
|
209 this [count] times. When already at the newest error
|
|
210 list, an error message is given.
|
|
211
|
|
212 When adding a new error list, it becomes the current list.
|
|
213
|
|
214 When ":colder" has been used and ":make" or ":grep" is used to add a new error
|
|
215 list, one newer list is overwritten. This is especially useful if you are
|
|
216 browsing with ":grep" |grep|. If you want to keep the more recent error
|
|
217 lists, use ":cnewer 99" first.
|
|
218
|
|
219 =============================================================================
|
|
220 4. Using :make *:make_makeprg*
|
|
221
|
|
222 *:mak* *:make*
|
|
223 :mak[e][!] [arguments] 1. If the 'autowrite' option is on, write any changed
|
|
224 buffers
|
|
225 2. An errorfile name is made from 'makeef'. If
|
|
226 'makeef' doesn't contain "##", and a file with this
|
|
227 name already exists, it is deleted.
|
|
228 3. The program given with the 'makeprg' option is
|
|
229 started (default "make") with the optional
|
|
230 [arguments] and the output is saved in the
|
|
231 errorfile (for Unix it is also echoed on the
|
|
232 screen).
|
|
233 4. The errorfile is read using 'errorformat'.
|
|
234 5. If [!] is not given the first error is jumped to.
|
|
235 6. The errorfile is deleted.
|
|
236 7. You can now move through the errors with commands
|
|
237 like |:cnext| and |:cprevious|, see above.
|
|
238 This command does not accept a comment, any "
|
|
239 characters are considered part of the arguments.
|
|
240
|
|
241 The ":make" command executes the command given with the 'makeprg' option.
|
|
242 This is done by passing the command to the shell given with the 'shell'
|
|
243 option. This works almost like typing
|
|
244
|
|
245 ":!{makeprg} [arguments] {shellpipe} {errorfile}".
|
|
246
|
|
247 {makeprg} is the string given with the 'makeprg' option. Any command can be
|
|
248 used, not just "make". Characters '%' and '#' are expanded as usual on a
|
|
249 command-line. You can use "%<" to insert the current file name without
|
|
250 extension, or "#<" to insert the alternate file name without extension, for
|
|
251 example: >
|
|
252 :set makeprg=make\ #<.o
|
|
253
|
|
254 [arguments] is anything that is typed after ":make".
|
|
255 {shellpipe} is the 'shellpipe' option.
|
|
256 {errorfile} is the 'makeef' option, with ## replaced to make it unique.
|
|
257
|
|
258 The placeholder "$*" can be used for the argument list in {makeprog} if the
|
|
259 command needs some additional characters after its arguments. The $* is
|
|
260 replaced then by all arguments. Example: >
|
|
261 :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}
|
|
262 or simpler >
|
|
263 :let &mp = 'latex \\nonstopmode \\input\{$*}'
|
|
264 "$*" can be given multiple times, for example: >
|
|
265 :set makeprg=gcc\ -o\ $*\ $*
|
|
266
|
|
267 The 'shellpipe' option defaults to ">" for the Amiga, MS-DOS and Win32. This
|
|
268 means that the output of the compiler is saved in a file and not shown on the
|
|
269 screen directly. For Unix "| tee" is used. The compiler output is shown on
|
|
270 the screen and saved in a file the same time. Depending on the shell used
|
|
271 "|& tee" or "2>&1| tee" is the default, so stderr output will be included.
|
|
272
|
|
273 If 'shellpipe' is empty, the {errorfile} part will be omitted. This is useful
|
|
274 for compilers that write to an errorfile themselves (e.g., Manx's Amiga C).
|
|
275
|
|
276 ==============================================================================
|
41
|
277 5. Using :vimgrep and :grep *grep* *lid*
|
|
278
|
|
279 Vim has two ways to find matches for a pattern: Internal and external. The
|
|
280 advantage of the internal grep is that it works on all systems and uses the
|
|
281 powerful Vim search patterns. An external grep program can be used when the
|
|
282 Vim grep does not do what you want.
|
|
283
|
|
284 The internal method may be a bit slower, because files are read into memory.
|
|
285 The advantage is that line separators and encoding are automatically
|
|
286 recognized, as if a file is being edited. And multi-line patterns can be
|
|
287 used.
|
|
288
|
|
289
|
|
290 5.1 using Vim's internal grep
|
|
291
|
|
292 *:vim* *:vimgrep*
|
|
293 :vim[grep][!] /{pattern}/ {file} ...
|
|
294 Search for {pattern} in the files {file} ... and set
|
|
295 the error list to the matches.
|
|
296 {pattern} if a Vim search pattern. Instead of
|
|
297 enclosing it in / any character can be used, so long
|
|
298 as it does not appear in {pattern}.
|
|
299
|
|
300 *:vimgrepa* *:vimgrepadd*
|
|
301 :vimgrepa[dd][!] /{pattern}/ {file} ...
|
|
302 Just like ":vimgrep", but instead of making a new list
|
|
303 of errors the matches are appended to the current
|
|
304 list.
|
|
305
|
|
306
|
|
307 5.2 External grep
|
7
|
308
|
|
309 Vim can interface with "grep" and grep-like programs (such as the GNU
|
|
310 id-utils) in a similar way to its compiler integration (see |:make| above).
|
|
311
|
|
312 [Unix trivia: The name for the Unix "grep" command comes from ":g/re/p", where
|
|
313 "re" stands for Regular Expression.]
|
|
314
|
|
315 *:gr* *:grep*
|
|
316 :gr[ep][!] [arguments] Just like ":make", but use 'grepprg' instead of
|
|
317 'makeprg' and 'grepformat' instead of 'errorformat'.
|
41
|
318 When 'grepprg' is "internal" this works like
|
|
319 |:vimgrep|. Note that the pattern needs to be
|
|
320 enclosed in separator characters then.
|
7
|
321 *:grepa* *:grepadd*
|
|
322 :grepa[dd][!] [arguments]
|
|
323 Just like ":grep", but instead of making a new list of
|
|
324 errors the matches are appended to the current list.
|
|
325 Example: >
|
|
326 :grep nothing %
|
|
327 :bufdo grepadd! something %
|
|
328 < The first command makes a new error list which is
|
|
329 empty. The second command executes "grepadd" for each
|
|
330 listed buffer. Note the use of ! to avoid that
|
|
331 ":grepadd" jumps to the first error, which is not
|
|
332 allowed with |:bufdo|.
|
|
333
|
41
|
334 5.3 Setting up external grep
|
7
|
335
|
|
336 If you have a standard "grep" program installed, the :grep command may work
|
|
337 well with the defaults. The syntax is very similar to the standard command: >
|
|
338
|
|
339 :grep foo *.c
|
|
340
|
|
341 Will search all files with the .c extension for the substring "foo". The
|
|
342 arguments to :grep are passed straight to the "grep" program, so you can use
|
|
343 whatever options your "grep" supports.
|
|
344
|
|
345 By default, :grep invokes grep with the -n option (show file and line
|
|
346 numbers). You can change this with the 'grepprg' option. You will need to set
|
|
347 'grepprg' if:
|
|
348
|
|
349 a) You are using a program that isn't called "grep"
|
|
350 b) You have to call grep with a full path
|
|
351 c) You want to pass other options automatically (e.g. case insensitive
|
|
352 search.)
|
|
353
|
|
354 Once "grep" has executed, Vim parses the results using the 'grepformat'
|
|
355 option. This option works in the same way as the 'errorformat' option - see
|
|
356 that for details. You may need to change 'grepformat' from the default if
|
|
357 your grep outputs in a non-standard format, or you are using some other
|
|
358 program with a special format.
|
|
359
|
|
360 Once the results are parsed, Vim loads the first file containing a match and
|
|
361 jumps to the appropriate line, in the same way that it jumps to a compiler
|
|
362 error in |quickfix| mode. You can then use the |:cnext|, |:clist|, etc.
|
|
363 commands to see the other matches.
|
|
364
|
|
365
|
41
|
366 5.4 Using :grep with id-utils
|
7
|
367
|
|
368 You can set up :grep to work with the GNU id-utils like this: >
|
|
369
|
|
370 :set grepprg=lid\ -Rgrep\ -s
|
|
371 :set grepformat=%f:%l:%m
|
|
372
|
|
373 then >
|
|
374 :grep (regexp)
|
|
375
|
|
376 works just as you'd expect.
|
|
377 (provided you remembered to mkid first :)
|
|
378
|
|
379
|
41
|
380 5.5 Browsing source code with :vimgrep or :grep
|
7
|
381
|
|
382 Using the stack of error lists that Vim keeps, you can browse your files to
|
|
383 look for functions and the functions they call. For example, suppose that you
|
|
384 have to add an argument to the read_file() function. You enter this command: >
|
|
385
|
41
|
386 :vimgrep /\<read_file\>/ *.c
|
7
|
387
|
|
388 You use ":cn" to go along the list of matches and add the argument. At one
|
|
389 place you have to get the new argument from a higher level function msg(), and
|
|
390 need to change that one too. Thus you use: >
|
|
391
|
41
|
392 :vimgrep /\<msg\>/ *.c
|
7
|
393
|
|
394 While changing the msg() functions, you find another function that needs to
|
41
|
395 get the argument from a higher level. You can again use ":vimgrep" to find
|
|
396 these functions. Once you are finished with one function, you can use >
|
7
|
397
|
|
398 :colder
|
|
399
|
|
400 to go back to the previous one.
|
|
401
|
41
|
402 This works like browsing a tree: ":vimgrep" goes one level deeper, creating a
|
7
|
403 list of branches. ":colder" goes back to the previous level. You can mix
|
41
|
404 this use of ":vimgrep" and "colder" to browse all the locations in a tree-like
|
7
|
405 way. If you do this consistently, you will find all locations without the
|
|
406 need to write down a "todo" list.
|
|
407
|
|
408 =============================================================================
|
|
409 6. Selecting a compiler *compiler-select*
|
|
410
|
|
411 *:comp* *:compiler* *E666*
|
|
412 :comp[iler][!] {name} Set options to work with compiler {name}.
|
|
413 Without the "!" options are set for the
|
|
414 current buffer. With "!" global options are
|
|
415 set.
|
|
416 If you use ":compiler foo" in "file.foo" and
|
|
417 then ":compiler! bar" in another buffer, Vim
|
|
418 will keep on using "foo" in "file.foo".
|
|
419 {not available when compiled without the
|
|
420 |+eval| feature}
|
|
421
|
|
422
|
|
423 The Vim plugins in the "compiler" directory will set options to use the
|
|
424 selected compiler. For ":compiler" local options are set, for ":compiler!"
|
|
425 global options.
|
|
426 *current_compiler*
|
|
427 To support older Vim versions, the plugins always use "current_compiler" and
|
|
428 not "b:current_compiler". What the command actually does is the following:
|
|
429
|
|
430 - Delete the "current_compiler" and "b:current_compiler" variables.
|
|
431 - Define the "CompilerSet" user command. With "!" it does ":set", without "!"
|
|
432 it does ":setlocal".
|
|
433 - Execute ":runtime! compiler/{name}.vim". The plugins are expected to set
|
|
434 options with "CompilerSet" and set the "current_compiler" variable to the
|
|
435 name of the compiler.
|
|
436 - Delete the "CompilerSet user command.
|
|
437 - Set "b:current_compiler" to the value of "current_compiler".
|
|
438 - Without "!" the old value of "current_compiler" is restored.
|
|
439
|
|
440
|
|
441 For writing a compiler plugin, see |write-compiler-plugin|.
|
|
442
|
|
443
|
|
444 MANX AZTEC C *quickfix-manx* *compiler-manx*
|
|
445
|
|
446 To use Vim with Manx's Aztec C compiler on the Amiga you should do the
|
|
447 following:
|
|
448 - Set the CCEDIT environment variable with the command: >
|
|
449 mset "CCEDIT=vim -q"
|
|
450 - Compile with the -qf option. If the compiler finds any errors, Vim is
|
|
451 started and the cursor is positioned on the first error. The error message
|
|
452 will be displayed on the last line. You can go to other errors with the
|
|
453 commands mentioned above. You can fix the errors and write the file(s).
|
|
454 - If you exit Vim normally the compiler will re-compile the same file. If you
|
|
455 exit with the :cq command, the compiler will terminate. Do this if you
|
|
456 cannot fix the error, or if another file needs to be compiled first.
|
|
457
|
|
458 There are some restrictions to the Quickfix mode on the Amiga. The
|
|
459 compiler only writes the first 25 errors to the errorfile (Manx's
|
|
460 documentation does not say how to get more). If you want to find the others,
|
|
461 you will have to fix a few errors and exit the editor. After recompiling,
|
|
462 up to 25 remaining errors will be found.
|
|
463
|
|
464 If Vim was started from the compiler, the :sh and some :! commands will not
|
|
465 work, because Vim is then running in the same process as the compiler and
|
|
466 stdin (standard input) will not be interactive.
|
|
467
|
|
468
|
|
469 PYUNIT COMPILER *compiler-pyunit*
|
|
470
|
|
471 This is not actually a compiler, but a unit testing framework for the
|
|
472 Python language. It is included into standard Python distribution
|
|
473 starting from version 2.0. For older versions, you can get it from
|
|
474 http://pyunit.sourceforge.net.
|
|
475
|
|
476 When you run your tests with the help of the framework, possible errors
|
|
477 are parsed by Vim and presented for you in quick-fix mode.
|
|
478
|
|
479 Unfortunately, there is no standard way to run the tests.
|
|
480 The alltests.py script seems to be used quite often, that's all.
|
|
481 Useful values for the 'makeprg' options therefore are:
|
|
482 setlocal makeprg=./alltests.py " Run a testsuite
|
|
483 setlocal makeprg=python % " Run a single testcase
|
|
484
|
|
485 Also see http://vim.sourceforge.net/tip_view.php?tip_id=280.
|
|
486
|
|
487
|
|
488 TEX COMPILER *compiler-tex*
|
|
489
|
|
490 Included in the distribution compiler for TeX ($VIMRUNTIME/compiler/tex.vim)
|
|
491 uses make command if possible. If the compiler finds a file named "Makefile"
|
|
492 or "makefile" in the current directory, it supposes that you want to process
|
|
493 your *TeX files with make, and the makefile does the right work. In this case
|
|
494 compiler sets 'errorformat' for *TeX output and leaves 'makeprg' untouched. If
|
|
495 neither "Makefile" nor "makefile" is found, the compiler will not use make.
|
|
496 You can force the compiler to ignore makefiles by defining
|
|
497 b:tex_ignore_makefile or g:tex_ignore_makefile variable (they are checked for
|
|
498 existence only).
|
|
499
|
|
500 If the compiler chose not to use make, it need to choose a right program for
|
|
501 processing your input. If b:tex_flavor or g:tex_flavor (in this precedence)
|
|
502 variable exists, it defines TeX flavor for :make (actually, this is the name
|
|
503 of executed command), and if both variables do not exist, it defaults to
|
|
504 "latex". For example, while editing chapter2.tex \input-ed from mypaper.tex
|
|
505 written in AMS-TeX: >
|
|
506
|
|
507 :let b:tex_flavor = 'amstex'
|
|
508 :compiler tex
|
|
509 < [editing...] >
|
|
510 :make mypaper
|
|
511
|
|
512 Note that you must specify a name of the file to process as an argument (to
|
|
513 process the right file when editing \input-ed or \include-ed file; portable
|
|
514 solution for substituting % for no arguments is welcome). This is not in the
|
|
515 semantics of make, where you specify a target, not source, but you may specify
|
|
516 filename without extension ".tex" and mean this as "make filename.dvi or
|
|
517 filename.pdf or filename.some_result_extension according to compiler".
|
|
518
|
|
519 Note: tex command line syntax is set to usable both for MikTeX (suggestion
|
|
520 by Srinath Avadhanula) and teTeX (checked by Artem Chuprina). Suggestion
|
|
521 from |errorformat-LaTeX| is too complex to keep it working for different
|
|
522 shells and OSes and also does not allow to use other available TeX options,
|
|
523 if any. If your TeX doesn't support "-interaction=nonstopmode", please
|
|
524 report it with different means to express \nonstopmode from the command line.
|
|
525
|
|
526 =============================================================================
|
|
527 7. The error format *error-file-format*
|
|
528
|
|
529 *errorformat* *E372* *E373* *E374*
|
|
530 *E375* *E376* *E377* *E378*
|
|
531 The 'errorformat' option specifies a list of formats that are recognized. The
|
|
532 first format that matches with an error message is used. You can add several
|
|
533 formats for different messages your compiler produces, or even entries for
|
|
534 multiple compilers. See |efm-entries|.
|
|
535
|
|
536 Each entry in 'errorformat' is a scanf-like string that describes the format.
|
|
537 First, you need to know how scanf works. Look in the documentation of your
|
|
538 C compiler. Below you find the % items that Vim understands. Others are
|
|
539 invalid.
|
|
540
|
|
541 Special characters in 'errorformat' are comma and backslash. See
|
|
542 |efm-entries| for how to deal with them. Note that a literal "%" is matched
|
|
543 by "%%", thus it is not escaped with a backslash.
|
|
544
|
|
545 Note: By default the difference between upper and lowercase is ignored. If
|
|
546 you want to match case, add "\C" to the pattern |/\C|.
|
|
547
|
|
548
|
|
549 Basic items
|
|
550
|
|
551 %f file name (finds a string)
|
|
552 %l line number (finds a number)
|
|
553 %c column number (finds a number representing character
|
|
554 column of the error, (1 <tab> == 1 character column))
|
|
555 %v virtual column number (finds a number representing
|
|
556 screen column of the error (1 <tab> == 8 screen
|
|
557 columns)
|
|
558 %t error type (finds a single character)
|
|
559 %n error number (finds a number)
|
|
560 %m error message (finds a string)
|
|
561 %r matches the "rest" of a single-line file message %O/P/Q
|
|
562 %p pointer line (finds a sequence of '-', '.' or ' ' and
|
|
563 uses the length for the column number)
|
|
564 %*{conv} any scanf non-assignable conversion
|
|
565 %% the single '%' character
|
|
566
|
|
567 The "%f" conversion depends on the current 'isfname' setting.
|
|
568
|
|
569 The "%f" and "%m" conversions have to detect the end of the string. They
|
|
570 should be followed by a character that cannot be in the string. Everything
|
|
571 up to that character is included in the string. But when the next character
|
|
572 is a '%' or a backslash, "%f" will look for any 'isfname' character and "%m"
|
|
573 finds anything. If the "%f" or "%m" is at the end, everything up to the end
|
|
574 of the line is included.
|
|
575
|
|
576 On MS-DOS, MS-Windows and OS/2 a leading "C:" will be included in "%f", even
|
|
577 when using "%f:". This means that a file name which is a single alphabetical
|
|
578 letter will not be detected.
|
|
579
|
|
580 The "%p" conversion is normally followed by a "^". It's used for compilers
|
|
581 that output a line like: >
|
|
582 ^
|
|
583 or >
|
|
584 ---------^
|
|
585 to indicate the column of the error. This is to be used in a multi-line error
|
|
586 message. See |errorformat-javac| for a useful example.
|
|
587
|
|
588
|
|
589 Changing directory
|
|
590
|
|
591 The following uppercase conversion characters specify the type of special
|
|
592 format strings. At most one of them may be given as a prefix at the begin
|
|
593 of a single comma-separated format pattern.
|
|
594 Some compilers produce messages that consist of directory names that have to
|
|
595 be prepended to each file name read by %f (example: GNU make). The following
|
|
596 codes can be used to scan these directory names; they will be stored in an
|
|
597 internal directory stack. *E379*
|
|
598 %D "enter directory" format string; expects a following
|
|
599 %f that finds the directory name
|
|
600 %X "leave directory" format string; expects following %f
|
|
601
|
|
602 When defining an "enter directory" or "leave directory" format, the "%D" or
|
|
603 "%X" has to be given at the start of that substring. Vim tracks the directory
|
|
604 changes and prepends the current directory to each erroneous file found with a
|
|
605 relative path. See |quickfix-directory-stack| for details, tips and
|
|
606 limitations.
|
|
607
|
|
608
|
|
609 Multi-line messages *errorformat-multi-line*
|
|
610
|
|
611 It is possible to read the output of programs that produce multi-line
|
|
612 messages, ie. error strings that consume more than one line. Possible
|
|
613 prefixes are:
|
|
614 %E start of a multi-line error message
|
|
615 %W start of a multi-line warning message
|
|
616 %I start of a multi-line informational message
|
|
617 %A start of a multi-line message (unspecified type)
|
|
618 %C continuation of a multi-line message
|
|
619 %Z end of a multi-line message
|
|
620 These can be used with '+' and '-', see |efm-ignore| below.
|
|
621
|
|
622 Example: Your compiler happens to write out errors in the following format
|
|
623 (leading line numbers not being part of the actual output):
|
|
624
|
|
625 1 Error 275
|
|
626 2 line 42
|
|
627 3 column 3
|
|
628 4 ' ' expected after '--'
|
|
629
|
|
630 The appropriate error format string has to look like this: >
|
|
631 :set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m
|
|
632
|
|
633 And the |:clist| error message generated for this error is:
|
|
634
|
|
635 1:42 col 3 error 275: ' ' expected after '--'
|
|
636
|
|
637 Another example: Think of a Python interpreter that produces the following
|
|
638 error message (line numbers are not part of the actual output):
|
|
639
|
|
640 1 ==============================================================
|
|
641 2 FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest)
|
|
642 3 --------------------------------------------------------------
|
|
643 4 Traceback (most recent call last):
|
|
644 5 File "unittests/dbfacadeTest.py", line 89, in testFoo
|
|
645 6 self.assertEquals(34, dtid)
|
|
646 7 File "/usr/lib/python2.2/unittest.py", line 286, in
|
|
647 8 failUnlessEqual
|
|
648 9 raise self.failureException, \
|
|
649 10 AssertionError: 34 != 33
|
|
650 11
|
|
651 12 --------------------------------------------------------------
|
|
652 13 Ran 27 tests in 0.063s
|
|
653
|
|
654 Say you want |:clist| write the relevant information of this message only,
|
|
655 namely:
|
|
656 5 unittests/dbfacadeTest.py:89: AssertionError: 34 != 33
|
|
657
|
|
658 Then the error format string could be defined as follows: >
|
|
659 :set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
|
|
660
|
|
661 Note that the %C string is given before the %A here: since the expression
|
|
662 ' %.%#' (which stands for the regular expression ' .*') matches every line
|
|
663 starting with a space, followed by any characters to the end of the line,
|
|
664 it also hides line 7 which would trigger a separate error message otherwise.
|
|
665 Error format strings are always parsed pattern by pattern until the first
|
|
666 match occurs.
|
|
667
|
|
668
|
|
669 Separate file name *errorformat-separate-filename*
|
|
670
|
|
671 These prefixes are useful if the file name is given once and multiple messages
|
|
672 follow that refer to this file name.
|
|
673 %O single-line file message: overread the matched part
|
|
674 %P single-line file message: push file %f onto the stack
|
|
675 %Q single-line file message: pop the last file from stack
|
|
676
|
|
677 Example: Given a compiler that produces the following error logfile (without
|
|
678 leading line numbers):
|
|
679
|
|
680 1 [a1.tt]
|
|
681 2 (1,17) error: ';' missing
|
|
682 3 (21,2) warning: variable 'z' not defined
|
|
683 4 (67,3) error: end of file found before string ended
|
|
684 5
|
|
685 6 [a2.tt]
|
|
686 7
|
|
687 8 [a3.tt]
|
|
688 9 NEW compiler v1.1
|
|
689 10 (2,2) warning: variable 'x' not defined
|
|
690 11 (67,3) warning: 's' already defined
|
|
691
|
|
692 This logfile lists several messages for each file enclosed in [...] which are
|
|
693 properly parsed by an error format like this: >
|
|
694 :set efm=%+P[%f],(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%-Q
|
|
695
|
|
696 A call of |:clist| writes them accordingly with their correct filenames:
|
|
697
|
|
698 2 a1.tt:1 col 17 error: ';' missing
|
|
699 3 a1.tt:21 col 2 warning: variable 'z' not defined
|
|
700 4 a1.tt:67 col 3 error: end of file found before string ended
|
|
701 8 a3.tt:2 col 2 warning: variable 'x' not defined
|
|
702 9 a3.tt:67 col 3 warning: 's' already defined
|
|
703
|
|
704 Unlike the other prefixes that all match against whole lines, %P, %Q and %O
|
|
705 can be used to match several patterns in the same line. Thus it is possible
|
|
706 to parse even nested files like in the following line:
|
|
707 {"file1" {"file2" error1} error2 {"file3" error3 {"file4" error4 error5}}}
|
|
708 The %O then parses over strings that do not contain any push/pop file name
|
|
709 information. See |errorformat-LaTeX| for an extended example.
|
|
710
|
|
711
|
|
712 Ignoring and using whole messages *efm-ignore*
|
|
713
|
|
714 The codes '+' or '-' can be combined with the uppercase codes above; in that
|
|
715 case they have to precede the letter, eg. '%+A' or '%-G':
|
|
716 %- do not include the matching multi-line in any output
|
|
717 %+ include the whole matching line in the %m error string
|
|
718
|
|
719 One prefix is only useful in combination with '+' or '-', namely %G. It parses
|
|
720 over lines containing general information like compiler version strings or
|
|
721 other headers that can be skipped.
|
|
722 %-G ignore this message
|
|
723 %+G general message
|
|
724
|
|
725
|
|
726 Pattern matching
|
|
727
|
|
728 The scanf()-like "%*[]" notation is supported for backward-compatibility
|
|
729 with previous versions of Vim. However, it is also possible to specify
|
|
730 (nearly) any Vim supported regular expression in format strings.
|
|
731 Since meta characters of the regular expression language can be part of
|
|
732 ordinary matching strings or file names (and therefore internally have to
|
|
733 be escaped), meta symbols have to be written with leading '%':
|
|
734 %\ the single '\' character. Note that this has to be
|
|
735 escaped ("%\\") in ":set errorformat=" definitions.
|
|
736 %. the single '.' character.
|
|
737 %# the single '*'(!) character.
|
|
738 %^ the single '^' character.
|
|
739 %$ the single '$' character.
|
|
740 %[ the single '[' character for a [] character range.
|
|
741 %~ the single '~' character.
|
|
742 When using character classes in expressions (see |/\i| for an overview),
|
|
743 terms containing the "\+" quantifier can be written in the scanf() "%*"
|
|
744 notation. Example: "%\\d%\\+" ("\d\+", "any number") is equivalent to "%*\\d".
|
|
745 Important note: The \(...\) grouping of sub-matches can not be used in format
|
|
746 specifications because it is reserved for internal conversions.
|
|
747
|
|
748
|
|
749 Multiple entries in 'errorformat' *efm-entries*
|
|
750
|
|
751 To be able to detect output from several compilers, several format patterns
|
|
752 may be put in 'errorformat', separated by commas (note: blanks after the comma
|
|
753 are ignored). The first pattern that has a complete match is used. If no
|
|
754 match is found, matching parts from the last one will be used, although the
|
|
755 file name is removed and the error message is set to the whole message. If
|
|
756 there is a pattern that may match output from several compilers (but not in a
|
|
757 right way), put it after one that is more restrictive.
|
|
758
|
|
759 To include a comma in a pattern precede it with a backslash (you have to type
|
|
760 two in a ":set" command). To include a backslash itself give two backslashes
|
|
761 (you have to type four in a ":set" command). You also need to put a backslash
|
|
762 before a space for ":set".
|
|
763
|
|
764
|
|
765 Valid matches *quickfix-valid*
|
|
766
|
|
767 If a line does not completely match one of the entries in 'errorformat', the
|
|
768 whole line is put in the error message and the entry is marked "not valid"
|
|
769 These lines are skipped with the ":cn" and ":cp" commands (unless there is
|
|
770 no valid line at all). You can use ":cl!" to display all the error messages.
|
|
771
|
|
772 If the error format does not contain a file name Vim cannot switch to the
|
|
773 correct file. You will have to do this by hand.
|
|
774
|
|
775
|
|
776 Examples
|
|
777
|
|
778 The format of the file from the Amiga Aztec compiler is:
|
|
779
|
|
780 filename>linenumber:columnnumber:errortype:errornumber:errormessage
|
|
781
|
|
782 filename name of the file in which the error was detected
|
|
783 linenumber line number where the error was detected
|
|
784 columnnumber column number where the error was detected
|
|
785 errortype type of the error, normally a single 'E' or 'W'
|
|
786 errornumber number of the error (for lookup in the manual)
|
|
787 errormessage description of the error
|
|
788
|
|
789 This can be matched with this 'errorformat' entry:
|
|
790 %f>%l:%c:%t:%n:%m
|
|
791
|
|
792 Some examples for C compilers that produce single-line error outputs:
|
|
793 %f:%l:\ %t%*[^0123456789]%n:\ %m for Manx/Aztec C error messages
|
|
794 (scanf() doesn't understand [0-9])
|
|
795 %f\ %l\ %t%*[^0-9]%n:\ %m for SAS C
|
|
796 \"%f\"\\,%*[^0-9]%l:\ %m for generic C compilers
|
|
797 %f:%l:\ %m for GCC
|
|
798 %f:%l:\ %m,%Dgmake[%*\\d]:\ Entering\ directory\ `%f',
|
|
799 %Dgmake[%*\\d]:\ Leaving\ directory\ `%f'
|
|
800 for GCC with gmake (concat the lines!)
|
|
801 %f(%l)\ :\ %*[^:]:\ %m old SCO C compiler (pre-OS5)
|
|
802 %f(%l)\ :\ %t%*[^0-9]%n:\ %m idem, with error type and number
|
|
803 %f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m
|
|
804 for GCC, with some extras
|
|
805
|
|
806 Extended examples for the handling of multi-line messages are given below,
|
|
807 see |errorformat-Jikes| and |errorformat-LaTeX|.
|
|
808
|
|
809 Note the backslash in front of a space and double quote. It is required for
|
|
810 the :set command. There are two backslashes in front of a comma, one for the
|
|
811 :set command and one to avoid recognizing the comma as a separator of error
|
|
812 formats.
|
|
813
|
|
814
|
|
815 Filtering messages
|
|
816
|
|
817 If you have a compiler that produces error messages that do not fit in the
|
|
818 format string, you could write a program that translates the error messages
|
|
819 into this format. You can use this program with the ":make" command by
|
|
820 changing the 'makeprg' option. For example: >
|
|
821 :set mp=make\ \\\|&\ error_filter
|
|
822 The backslashes before the pipe character are required to avoid it to be
|
|
823 recognized as a command separator. The backslash before each space is
|
|
824 required for the set command.
|
|
825
|
|
826 =============================================================================
|
|
827 8. The directory stack *quickfix-directory-stack*
|
|
828
|
|
829 Quickfix maintains a stack for saving all used directories parsed from the
|
|
830 make output. For GNU-make this is rather simple, as it always prints the
|
|
831 absolute path of all directories it enters and leaves. Regardless if this is
|
|
832 done via a 'cd' command in the makefile or with the parameter "-C dir" (change
|
|
833 to directory before reading the makefile). It may be useful to use the switch
|
|
834 "-w" to force GNU-make to print out the working directory before and after
|
|
835 processing.
|
|
836
|
|
837 Maintaining the correct directory is more complicated if you don't use
|
|
838 GNU-make. AIX-make for example doesn't print any information about its working
|
9
|
839 directory. Then you need to enhance the makefile. In the makefile of LessTif
|
7
|
840 there is a command which echoes "Making {target} in {dir}". The special
|
|
841 problem here is that it doesn't print informations on leaving the directory
|
|
842 and that it doesn't print the absolute path.
|
|
843
|
|
844 To solve the problem with relative paths and missing "leave directory"
|
|
845 messages Vim uses following algorithm:
|
|
846
|
|
847 1) Check if the given directory is a subdirectory of the current directory.
|
|
848 If this is true, store it as the current directory.
|
|
849 2) If it is not a subdir of the current directory, try if this is a
|
|
850 subdirectory of one of the upper directories.
|
|
851 3) If the directory still isn't found, it is assumed to be a subdirectory
|
|
852 of Vim's current directory.
|
|
853
|
|
854 Additionally it is checked for every file, if it really exists in the
|
|
855 identified directory. If not, it is searched in all other directories of the
|
|
856 directory stack (NOT the directory subtree!). If it is still not found, it is
|
|
857 assumed that it is in Vim's current directory.
|
|
858
|
|
859 There are limitation in this algorithm. This examples assume that make just
|
|
860 prints information about entering a directory in the form "Making all in dir".
|
|
861
|
|
862 1) Assume you have following directories and files:
|
|
863 ./dir1
|
|
864 ./dir1/file1.c
|
|
865 ./file1.c
|
|
866
|
|
867 If make processes the directory "./dir1" before the current directory and
|
|
868 there is an error in the file "./file1.c", you will end up with the file
|
|
869 "./dir1/file.c" loaded by Vim.
|
|
870
|
|
871 This can only be solved with a "leave directory" message.
|
|
872
|
|
873 2) Assume you have following directories and files:
|
|
874 ./dir1
|
|
875 ./dir1/dir2
|
|
876 ./dir2
|
|
877
|
|
878 You get the following:
|
|
879
|
|
880 Make output Directory interpreted by Vim
|
|
881 ------------------------ ----------------------------
|
|
882 Making all in dir1 ./dir1
|
|
883 Making all in dir2 ./dir1/dir2
|
|
884 Making all in dir2 ./dir1/dir2
|
|
885
|
|
886 This can be solved by printing absolute directories in the "enter directory"
|
|
887 message or by printing "leave directory" messages..
|
|
888
|
|
889 To avoid this problems, ensure to print absolute directory names and "leave
|
|
890 directory" messages.
|
|
891
|
|
892 Examples for Makefiles:
|
|
893
|
|
894 Unix:
|
|
895 libs:
|
|
896 for dn in $(LIBDIRS); do \
|
|
897 (cd $$dn; echo "Entering dir '$$(pwd)'"; make); \
|
|
898 echo "Leaving dir"; \
|
|
899 done
|
|
900
|
|
901 Add
|
|
902 %DEntering\ dir\ '%f',%XLeaving\ dir
|
|
903 to your 'errorformat' to handle the above output.
|
|
904
|
|
905 Note that Vim doesn't check if the directory name in a "leave directory"
|
|
906 messages is the current directory. This is why you could just use the message
|
|
907 "Leaving dir".
|
|
908
|
|
909 =============================================================================
|
|
910 9. Specific error file formats *errorformats*
|
|
911
|
|
912 *errorformat-Jikes*
|
|
913 Jikes(TM), a source-to-bytecode Java compiler published by IBM Research,
|
|
914 produces simple multi-line error messages.
|
|
915
|
|
916 An 'errorformat' string matching the produced messages is shown below.
|
|
917 The following lines can be placed in the user's |vimrc| to overwrite Vim's
|
|
918 recognized default formats, or see |:set+=| how to install this format
|
|
919 additionally to the default. >
|
|
920
|
|
921 :set efm=%A%f:%l:%c:%*\\d:%*\\d:,
|
|
922 \%C%*\\s%trror:%m,
|
|
923 \%+C%*[^:]%trror:%m,
|
|
924 \%C%*\\s%tarning:%m,
|
|
925 \%C%m
|
|
926 <
|
|
927 Jikes(TM) produces a single-line error message when invoked with the option
|
|
928 "+E", and can be matched with the following: >
|
|
929
|
|
930 :set efm=%f:%l:%v:%*\\d:%*\\d:%*\\s%m
|
|
931 <
|
|
932 *errorformat-javac*
|
|
933 This 'errorformat' has been reported to work well for javac, which outputs a
|
|
934 line with "^" to indicate the column of the error: >
|
|
935 :set efm=%A%f:%l:\ %m,%-Z%p^,%-C%.%#
|
|
936 or: >
|
|
937 :set efm=%A%f:%l:\ %m,%+Z%p^,%+C%.%#,%-G%.%#
|
|
938 <
|
|
939 *errorformat-ant*
|
|
940 For ant (http://jakarta.apache.org/) the above errorformat has to be modified
|
|
941 to honour the leading [javac] in front of each javac output line: >
|
|
942 :set efm=%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#
|
|
943
|
|
944 The 'errorformat' can also be configured to handle ant together with either
|
|
945 javac or jikes. If you're using jikes, you should tell ant to use jikes' +E
|
|
946 command line switch which forces jikes to generate one-line error messages.
|
|
947 This is what the second line (of a build.xml file) below does: >
|
|
948 <property name = "build.compiler" value = "jikes"/>
|
|
949 <property name = "build.compiler.emacs" value = "true"/>
|
|
950
|
|
951 The 'errorformat' which handles ant with both javac and jikes is: >
|
|
952 :set efm=\ %#[javac]\ %#%f:%l:%c:%*\\d:%*\\d:\ %t%[%^:]%#:%m,
|
|
953 \%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#
|
|
954 <
|
|
955 *errorformat-jade*
|
|
956 parsing jade (see http://www.jclark.com/) errors is simple: >
|
|
957 :set efm=jade:%f:%l:%c:%t:%m
|
|
958 <
|
|
959 *errorformat-LaTeX*
|
|
960 The following is an example how an 'errorformat' string can be specified
|
|
961 for the (La)TeX typesetting system which displays error messages over
|
|
962 multiple lines. The output of ":clist" and ":cc" etc. commands displays
|
|
963 multi-lines in a single line, leading white space is removed.
|
|
964 It should be easy to adopt the above LaTeX errorformat to any compiler output
|
|
965 consisting of multi-line errors.
|
|
966
|
|
967 The commands can be placed in a |vimrc| file or some other Vim script file,
|
|
968 eg. a script containing LaTeX related stuff which is loaded only when editing
|
|
969 LaTeX sources.
|
|
970 Make sure to copy all lines of the example (in the given order), afterwards
|
|
971 remove the comment lines. For the '\' notation at the start of some lines see
|
|
972 |line-continuation|.
|
|
973
|
|
974 First prepare 'makeprg' such that LaTeX will report multiple
|
|
975 errors; do not stop when the first error has occurred: >
|
|
976 :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}
|
|
977 <
|
|
978 Start of multi-line error messages: >
|
|
979 :set efm=%E!\ LaTeX\ %trror:\ %m,
|
|
980 \%E!\ %m,
|
|
981 < Start of multi-line warning messages; the first two also
|
|
982 include the line number. Meaning of some regular expressions:
|
|
983 - "%.%#" (".*") matches a (possibly empty) string
|
|
984 - "%*\\d" ("\d\+") matches a number >
|
|
985 \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
|
|
986 \%+W%.%#\ at\ lines\ %l--%*\\d,
|
|
987 \%WLaTeX\ %.%#Warning:\ %m,
|
|
988 < Possible continuations of error/warning messages; the first
|
|
989 one also includes the line number: >
|
|
990 \%Cl.%l\ %m,
|
|
991 \%+C\ \ %m.,
|
|
992 \%+C%.%#-%.%#,
|
|
993 \%+C%.%#[]%.%#,
|
|
994 \%+C[]%.%#,
|
|
995 \%+C%.%#%[{}\\]%.%#,
|
|
996 \%+C<%.%#>%.%#,
|
|
997 \%C\ \ %m,
|
|
998 < Lines that match the following patterns do not contain any
|
|
999 important information; do not include them in messages: >
|
|
1000 \%-GSee\ the\ LaTeX%m,
|
|
1001 \%-GType\ \ H\ <return>%m,
|
|
1002 \%-G\ ...%.%#,
|
|
1003 \%-G%.%#\ (C)\ %.%#,
|
|
1004 \%-G(see\ the\ transcript%.%#),
|
|
1005 < Generally exclude any empty or whitespace-only line from
|
|
1006 being displayed: >
|
|
1007 \%-G\\s%#,
|
|
1008 < The LaTeX output log does not specify the names of erroneous
|
|
1009 source files per line; rather they are given globally,
|
|
1010 enclosed in parentheses.
|
|
1011 The following patterns try to match these names and store
|
|
1012 them in an internal stack. The patterns possibly scan over
|
|
1013 the same input line (one after another), the trailing "%r"
|
|
1014 conversion indicates the "rest" of the line that will be
|
|
1015 parsed in the next go until the end of line is reached.
|
|
1016
|
|
1017 Overread a file name enclosed in '('...')'; do not push it
|
|
1018 on a stack since the file apparently does not contain any
|
|
1019 error: >
|
|
1020 \%+O(%f)%r,
|
|
1021 < Push a file name onto the stack. The name is given after '(': >
|
|
1022 \%+P(%f%r,
|
|
1023 \%+P\ %\\=(%f%r,
|
|
1024 \%+P%*[^()](%f%r,
|
|
1025 \%+P[%\\d%[^()]%#(%f%r,
|
|
1026 < Pop the last stored file name when a ')' is scanned: >
|
|
1027 \%+Q)%r,
|
|
1028 \%+Q%*[^()])%r,
|
|
1029 \%+Q[%\\d%*[^()])%r
|
|
1030
|
|
1031 Note that in some cases file names in the LaTeX output log cannot be parsed
|
|
1032 properly. The parser might have been messed up by unbalanced parentheses
|
|
1033 then. The above example tries to catch the most relevant cases only.
|
|
1034 You can customize the given setting to suit your own purposes, for example,
|
|
1035 all the annoying "Overfull ..." warnings could be excluded from being
|
|
1036 recognized as an error.
|
|
1037 Alternatively to filtering the LaTeX compiler output, it is also possible
|
|
1038 to directly read the *.log file that is produced by the [La]TeX compiler.
|
|
1039 This contains even more useful information about possible error causes.
|
|
1040 However, to properly parse such a complex file, an external filter should
|
|
1041 be used. See the description further above how to make such a filter known
|
|
1042 by Vim.
|
|
1043
|
|
1044 *errorformat-Perl*
|
|
1045 In $VIMRUNTIME/tools you can find the efm_perl.pl script, which filters Perl
|
|
1046 error messages into a format that quickfix mode will understand. See the
|
|
1047 start of the file about how to use it.
|
|
1048
|
|
1049
|
|
1050
|
|
1051 vim:tw=78:ts=8:ft=help:norl:
|