ctrlsf.vim
ctrlsf.vim copied to clipboard
Populate CtrlSF from traditional quickfix list?
Can CtrlSF results be populated from a traditional quickfix window? I'm using another plugin which populates the quickfix, and it'd be cool if we could call a function to transfer what's in the quickfix to CtrlSF to see more context and use CtrlSF's edit mode on the results of this other plugin 😬
Maybe something like ctrlsf#db#SetResultSetFromQuickfix()
🤔
It's almost impossible because the context lines to show must exist at first, but in your case, they do not exist at all in anywhere of Vim.
But what plugin are you using to populate the quickfix? If it does also read result from a grep-like program, maybe CtrlSF could adopt that as a new backend.
Not a new grep-like, it's just ag under the hood.
I'm using two plugins actually, fzf.vim and vim-agriculture. Fzf.vim has this awesome realtime filtering post-search that's a big part of my workflow. And agriculture provides an awesome :AgRaw
command that lets me pass raw command line arguments directly to ag. If you want to know more, I actually just wrote a post detailing my workflow here.
That said, I absolutely love CtrlSF post-search, with how you display and allow editing of results 🔥 But I'd like to combine that with my own call to ag
. Anyway...
It's almost impossible because the context lines to show must exist at first, but in your case, they do not exist at all in anywhere of Vim.
If we can't populate from the quickfix, I actually have access to the both the raw ag output, and the filtered results from fzf.vim. Maybe I can pass my ag output into CtrlSF via a function call somehow?
PS. Not sure if you are open to chatting more on Discord? If so, hit me up at jesseleite#8296!
Ok, I have got your point, it seems quite possible now. Suppose you have read the source code, add a new argument (like -external
) that makes CtrlSF read resultset/output from a given variable, then CtrlSF will do the rest.
Make sure it does not interfere with the async mode.
Like?
:CtrlSF -external 'agriculture#ctrlsf_output'
Or a new command like?
:CtrlSFFromExternal 'agriculture#ctrlsf_output'
Looks like the -external
can not be combined with other arguments, I think a new command may be better.