I know that the quickfix list is very useful for the edit-compile-edit cycle. I like the fact that we can jump directly to an error from it.

Actually I am trying to understand the way I can parse a given error message with the errorformat built-in variable efm (see :help errorformat).

I have some error messages put in some training files and I want to import them into the quickfix list to test my regexp set in my efm variable (e.g. set efm=%C %.%#...).

I know that I can open an error message in a file with:

vim -q errorfile

But this way, I need to quit vim and open the desired file (I can lose my values set on the fly).

Is there a way to open the file in the quickfix list without leaving vim?

1 Answer 1


Try :h :cfile or :h :cgetfile

:cf[ile][!] [errorfile] Read the error file and jump to the first error.
            This is done automatically when Vim is started with
            the -q option.  You can use this command when you
            keep Vim running while compiling.  If you give the
            name of the errorfile, the 'errorfile' option will
            be set to [errorfile].  See |:cc| for [!].
            If the encoding of the error file differs from the
            'encoding' option, you can use the 'makeencoding'
            option to specify the encoding.
  • 1
    Thanks a lot! That's exactly what I was looking for! (I need to wait 9 minutes before validating the answer) Dec 28, 2020 at 16:48
  • 1
    Also, there is :make, which runs makecmd and uses its output as an errorfile. Dec 29, 2020 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.