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:
- It jumps to the first match (which I find disorientating).
- 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?
job_start
with theon_exit
callback. Isn’t that enough?cgete[xpr]
is likecexpr
but doesn't jump to the first match.