-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add "smart" autoquote mode #21
base: master
Are you sure you want to change the base?
Conversation
Hi @goolmoos thank you for your contribution. Would it work for you if the idea from here will be implemented: #13 (comment) : There has been an excessive discussion about that topic with the conclusion that a shortcut to quote the current prompt would solve most of the issues. In terms of key presses From your example:
|
Hey @weeman1337 I actually support @goolmoos idea, it feel more intuitive to use |
Can you give this branch a try #22 ?
Can you give me an example? Using
Instead I would do:
The latter is exactly what the branch provides you a shortcut for. |
No, It would not mess with anything. |
You can check my comments here, and see if they make any sense: #27 (comment) I don't know if I came up with the idea of using |
Personally I find the |
My main problem with the
^ I didn't realize ripgrep doesn't parse
Whereas the functionality being suggested in this PR suggests you can pass options/flags after the If "live-grep-args" is meant to allow you to pass "args" directly to ripgrep just as you would on the command line, then I'd lean towards saying prompt input should reflect that. Rather than relying on custom prompt input magic, why not leverage the picker mapping system (as @weeman1337 did with his awesome quote mapping, especially considering it's the same number of keystrokes even)? Also as an aside, if we start treating function isAppClosed(appName)
return not isAppOpen(appName) -- TODO: Refactor this
end Anyway, just some thoughts ❤️ |
Regarding the meaning of the double dash, this is exactly why I chose it, as its meaning here is to indicate a change of interpretation for the following arguments. I agree that it is not exactly the same as the "regular" meaning, but I found it intuitive to use, and I am not the only one that feels that way:
As to the problem with searching for lua comments, you can always quote the prompt, and it will work as expected: And of course, if someone finds this mechanism confusing, it is entirely optional and doesn't have to be turned on, the default is still |
I know I already said my opinion but after trying both ways the auto quote method feels much more intuitive, if both ways can leave in the source code and can be enable by an option it will be the best. |
the part before -- is taken as is, and the part after is splitted. For example: multi word search -- -flag --another-flag => "multi word search", "-flag", "--another-flag"
0bb516d
to
e50914e
Compare
e50914e
to
6168c45
Compare
Thanks for updating this PR @goolmoos 👍 I will review it soon. |
After thinking once more about the discussion above, I don't want to add this to the parser. Instead I've opened a pull request, that enables you to provide a custom parser function: #49 The „smart“ auto quoting is controversial (see discussion) and I don't want to maintain a higher complexity in the parser. Can you test if that is enough to implement the „smart auto quoting“? We can probably maintain different parser strategies in issues or the wiki of this project. If you can post your snippet here I will create an issue for that. |
It probably can be implemented using the custom parser, by copying the code of the parser. |
Coming back to this. I have read the ripgrep man page and found this for the pattern:
I would be up for providing e a Prompt: What do you think? |
Allows setting the autoquote option to "smart".
When enabled, the part before "--" is taken as is, and the part after is splitted.
For example:
prompt: multi word search -- -f --another-flag
args: "multi word search", "-f", "--another-flag"
like autoquote=true, this is disabled when the prompt begins with one of ' " -