Custom delimiter workaround #3404
|
I would like to be able to specify a delimiter. I see a closed issue regarding this from 7 years ago. Here is my use-case: local grep_cmd = function(opts)
local cmd = [[
rg \
--trim \
--no-heading \
--smart-case \
%s \
--fixed-strings \
%s \
%s \
--regexp="%s" \
%s \
| \
sed 's/:/%s/; s/:/%s/; s/:/%s/' \
]]
return string.format(
cmd,
opts.without_linenr and "--no-line-number" or "--column",
opts.iglob and "--iglob=" .. opts.iglob or "",
opts.with_filename and "--with-filename" or "",
opts.pattern or ".",
vim.fn.join(opts.search_in) or ".",
delim,
delim,
delim
)
end |
Replies: 2 comments 2 replies
|
ripgrep's default output, like grep, isn't easily machine readable that is robust against false positives. Unlike grep, ripgrep provides a stable JSON output format via the That is where I would suggest looking if you truly need something robust. There is a big gap between the default output format and JSON though. So there may be some work involved. The middle ground is maintaining a tiny targeted patch in a fork of ripgrep that you control with the functionality you need. |
|
Thank for the response! |
ripgrep's default output, like grep, isn't easily machine readable that is robust against false positives. Unlike grep, ripgrep provides a stable JSON output format via the
--jsonflag. This is a robust way to get a zero false positive rate.That is where I would suggest looking if you truly need something robust. There is a big gap between the default output format and JSON though. So there may be some work involved.
The middle ground is maintaining a tiny targeted patch in a fork of ripgrep that you control with the functionality you need.