Search code examples
vimgrepag

Vim Ag Plugin Context Option and Show Results in Tab


I am using Gvim with Ag.vim plugin for search. I am trying to use options for --before 4 and --after 4 to get the context of the code. It returns the results in quickfix window as a single line. How to show the before and after code for a search pattern?

Here is my search pattern and path.

:Ag -i --after 4 --before 4 pattern /search/path/

Is there a way to show the results in buffer or a tab rather than quickfix window?

I added this in my vimrc but it still shows the results in quickfix window.

let g:ag_lhandler="topleft lopen"

Thanks.


Solution

  • All the requirements of my question can be fulfilled by a Vim plugin called CtrlSF (CtrlSF Vim Plugin) Thanks to @SatoKatsura for the recommendation.