8

Vim 8.1's release note seems to indicate that you can feed output from make running in a terminal window to a quickfix list, but I couldn't find any detailed explanation. Is there a way to do this automatically, or do I have to manually add to the quickfix list using :caddbuffer ?

4
  • Is this common? What kind of task is this for? The most common quickfix usages are linting and grepping. If you are linting then use :make or ALE. If you are searching, then use :grep. Otherwise you will probably need to do something like :cgetbuffer or more likely <c-w>N then yank the output, :cexpr @@ Jun 8, 2018 at 17:27
  • 1
    "The detected errors can be caught and added to a quickfix list, so you can jump straight to the cause of the problem." OP just wants to know what the person who wrote this (Bram?) meant.
    – Mass
    Jun 8, 2018 at 18:37
  • @PeterRincker I often use :make and :grep, but it bothers me how it blocks the whole editor while it's running. Using the terminal window like in the release note looks like a promising alternative. The passage in the release note that @Mass metioned seems to suggest that there's an easy way to do this, but I'm not really sure. Jun 9, 2018 at 0:03
  • 2
    See github.com/vim/vim/issues/2955 Jun 9, 2018 at 8:14

2 Answers 2

2

I have made a small plugin vpager. That allows to dump the terminal output back into Vim.

The last commit in addition allows to use the output and dump it into the quickfix list. So you can simply do :make |vpager -Q and it should be loaded back in Vim.

(It might need adjustments for the errorformat setting, not sure).

excerpt from the README:

git diff | vpager -nC 'ft=diff'

  Copies the output of git diff into a buffer inside Vim. Any previous
  output in the buffer will be cleared and the filetype will be set
  to "diff", for proper syntax highlighting.

  grep -n <searchterm> files | vpager -Q

  Parses the grep -n output, copies it back into the quickfix buffer
  and opens the first result in a new window.
2

I guess caddbuffer is currently the best way to achieve what I want.

Your Answer

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

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