Closed cds-amal closed 4 years ago
do you know if ag
has vimgrep
option?
By the way, I'd recommend against using the vimgrep
option -- this puts every match as a separate candidate, even there are multiple on the same line. For short strings (or an fzf-like fuzzy grep), this lead to massively redundant results. I'd recommend using
finder = finders.new_oneshot_job {'rg', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', search},
instead.
Ag should have similar options (including vimgrep
, if you prefer):
https://github.com/ggreer/the_silver_searcher/blob/master/doc/ag.1.md
Both the separate candidate per match and the collapse matches per line would be useful for me. What about exposing both and let the user map one or both depending on their needs?
╭─~/dev/test-ag
╰─$ cat a/b/c/test-example.txt
foo bar foo
foo
exefoo
╭─~/dev/test-ag
╰─$ ag --vimgrep foo
a/b/c/test-example.txt:1:1:foo bar foo
a/b/c/test-example.txt:1:9:foo bar foo
a/b/c/test-example.txt:2:1:foo
a/b/c/test-example.txt:3:4:exefoo
╭─~/dev/test-ag
╰─$ ag --vimgrep exe
a/b/c/test-example.txt:3:1:exefoo
╭─~/dev/test-ag
╰─$ ag --vimgrep bar
a/b/c/test-example.txt:1:5:foo bar foo
With latest commit, you can set vimgrep_arguments
for yourself. Now anything can work ;)
If you want something more specific. Let me know. I'll close in the mean time.
Please support silver searcher as well as rip grep.