I made my own vim wrapper around ripgrep (I know there is vim-grepper, but I wanted to try customize some things).

The crux of it is I populate a quickfix window as follows:

let searchString = input('Search in Files '.getcwd().': ')
silent cexpr system('rg -H --no-heading --column '.searchString)
silent copen

There are two problems with this cexpr approach:

  1. It jumps to the first match (which I find disorientating).
  2. It blocks editing.

To solve these issues, I have searched around, andit seems asynchronous jobs require hundreds of lines of code, or plugin helpers (which I am trying to avoid so I can hopefully turn this tool into a plugin). One way seems to be just to use Neovim's terminal:

        terminal rg -H --no-heading --column 'search expression'

This is quite easy to do. However the only part I don't know how to do is pull in the lines into a quickfix window. Under [:h cexpr] There seems to be a hint about pulling in certain lines from a file:

:cexpr getline(1, '$')

How does one reference the lines from the terminal buffer, so one can pull them into the quick fix window? And even better update the Quickfix window in realtime as entries are found?

  • 2
    vpager by chrisbra can help or show how one can achieve this.
    – Hotschke
    Apr 18, 2020 at 6:07
  • 2
    Asynchronous jobs require as much code as your plugin needs. The bare minimum is a call to job_start with the on_exit callback. Isn’t that enough?
    – Tae
    Apr 18, 2020 at 6:16
  • Just read that cgete[xpr] is like cexpr but doesn't jump to the first match. Apr 19, 2020 at 17:56

1 Answer 1


Paging through the help this morning, I stumbled across cbuffer, which reads values from a buffer:

:cb[uffer][!] [bufnr]   Read the error list from the current buffer.
            When [bufnr] is given it must be the number of a
            loaded buffer.  That buffer will then be used instead
            of the current buffer.
            A range can be specified for the lines to be used.
            Otherwise all lines in the buffer are used.
            See |:cc| for [!].

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.