New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
escape settings (and highlight) - clarification needed #184
Comments
Think of the prompt as the end of shell input. 1. and 2. work because When you enter the query manually, the escape characters are not used at all. The escape characters are important for these cases:
Highlighting is complicated. It's easy to think of a few approaches, but it's hard to get right. That means it should work 1) for all tools the same, 2) should not depend on ANSI colors, and 3) should not break other already working features. I'm open for discussions and PRs, but since I can't think of a promising approach, I won't work on it myself. |
I hope the above makes it clearer. Thanks for bringing this up! ✨ |
It really does! Thanks!
…On Thu, Nov 8, 2018, 5:26 PM Marco Hinz ***@***.*** wrote:
I hope the above makes it clearer. Thanks for bringing this up! ✨
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#184 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA79a-CXzZjNfgiBIazZN1wdoaKa1K_nks5utFspgaJpZM4YUa7F>
.
|
This plugin is awesome! However, I would suggest specifying the role of the "escape" setting for a tool a bit clearer. I am not completely certain what is does and what it doesn't.
I have the ripgrep tool with the default escape chars
'\^$.*+?()[]{}|'
. This is what I get::Grepper <CR>
->(toolprompt) >
'(xmap|xnoreremap)'
-- this gets me results for both terms. Note the'
around the pattern.:Grepper <CR>
->(toolprompt) >
\(xmap\|xnoreremap\)
-- this gets me results for both terms. No single quotes this time'\(xmap\|xnoreremap\)'
: no results found and(xmap|xnoremap)
: syntax error:(
unexpected.I checked the g:grepper dictionary to be sure the settings were correct, this is the relevant entry:
'rgni': {'escape': '\^$.*+?()[]{}|', 'grepformat': '%f:%l:%c:%m', 'grepprg': 'rg -H --no-heading --vimgrep --no-ignore-vcs '},
So, it seems to me, the escape chars are not actually applied to the query I enter? Both with and without quotes? It would be very helpful to get an elaboration on that.
Additionally, the issue of highlighting the matches in the quickfix window: With 2), the matches are highlightes correctly which is very satisfying. With 1) this does not work. Are the escape characters used to convert the query to a vim regex string, or is the query used as-is to populate the
/
register? Are (at least) the quotes removed if there are any, like in 1)?To that end, after having read #60 , I could envision a method to get precise highlighting from using the query together with the escape settings, if
\V
highlight string. This would work with all the standard regex operators like |, ?, *, +, ... . Grepper would need to strip single quotes from the query (reverse engineering shell behavior as to what the grep program actually receives, but lets keep it at just the quotes), then take that string and escape any special character theescape
setting indicates, and prefix it with a '\V'I'd contribute that, but I need to know the meaning of the
escape
option...Thanks for clarifying!
The text was updated successfully, but these errors were encountered: