8

The common use of Vim's quickfix is to hand off compilation of code to a command specified by the suggestively named makeprg variable and then interpret the errors printed by that command so you can quickly jump to the file, row, and column location of each error.

Vim's quickfix can be subverted and used in other ways but my question only concerns how to reproduce the above described behavior.

What Emacs feature is nearest to Vim's quickfix?

Praxeolitic
  • 387
  • 2
  • 9
  • For people looking for cycling through quickfix results like with vimgrep or Neovim's telescope.nvim - especially with Doom Emacs - see https://emacs.stackexchange.com/questions/35554/display-search-results-in-their-own-buffer –  Apr 01 '22 at 22:34

1 Answers1

16

Compilation Mode does the same thing and is built-in. Here is a demo. Basic usage:

  • M-x compile to run the compilation command (like :make)
  • The command is taken from the variable compile-command (like the makeprg option)
  • M-g p and M-g n to go to the location of the previous/next error (like :cp and :cn)
  • M-{ and M-} to go to the previous/next file with an error (like :cnf and :cpf)

You also have flycheck for on-the-fly syntax checking, support 43 languages with 73 syntax checkers. Here is a flycheck demo (from the Github page). As you see, when the erroneous code is fixed, the error list refreshes automatically. And of course, you can click or press RET on the errors in the list to jump to the erroneous location.

Tu Do
  • 6,772
  • 20
  • 39
  • 1
    Is there a way to load text from a file? With vim I would generate text and load it in with `cfile` - see: https://stackoverflow.com/questions/18974140 – ideasman42 Nov 19 '17 at 04:47