Wiki

by yszheda

View project onGitHub

Tip 107: Customize the External Compiler

Return to the top: <<Practical Vim>>

Configure ':make'

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h 'makeprg'

Populate the Quickfix List Using Configured Output

The 'errorformat' setting allows us to teach Vim how to parse the output generated by running :make.

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h 'errorformat'
  • inspect the default value:
    :setglobal errorformat?
    errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m, ...[abridged]...
    

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h errorformat
  • set the error format:
    :setlocal efm=%A%f\,\ line\ %l\,\ character\ %c:%m,%Z%.%#,%-G%.%#
    

Set Up 'makeprg' and 'errorformat' with a Single Command

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h :compiler

:compiler and :make Are Not Just for Compiled Languages