Vim Recall繁體中文

Run external command 'makeprg' and parse error messages

:lmake

Example

Normal 0 / 3

Run external command 'makeprg' and parse error messages.

Prepared diagnostic command

makeprg
printf 'main.c:2:unknown identifier BROKEN\n'
errorformat
%f:%l:%m
autowrite
off

Current-window location list

Entries
none
Before & after

Before

Prepared diagnostic command

makeprg
printf 'main.c:2:unknown identifier BROKEN\n'
errorformat
%f:%l:%m
autowrite
off

Current-window location list

Entries
none

After

Diagnostic command output

printf stdout
main.c:2:unknown identifier BROKEN

Current-window location list

1
main.c:2:unknown identifier BROKEN

Documentation-backed illustration. +quickfix; ordinary interactive terminal Vim with English messages, no :silent or queued/stuffed input; shell=/bin/sh, shellcmdflag=-c, shellquote and shellxquote empty; printf and tee available, shellpipe=2>&1 | tee, and makeef empty with a writable generated temporary errorfile; the displayed literal makeprg and errorformat; autowrite and autowriteall off, nowarn, no interfering autocommands; messagesopt=hit-enter,history:500; unrestricted shell execution; the diagnostic is emitted by printf, not an actual compiler; data only. :lmake! runs the prepared diagnostic command. After Enter acknowledges shell return, Vim parses the output into the current-window location list; ! prevents a jump to the first error. Primary help: :lmake.

Sample buffer
int main(void) {
  BROKEN
}
Cursor on line 1, column 1
Details & Vim help

Run external command 'makeprg' and parse error messages. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :lmak[e] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.