You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to search for a regexp where the whitespace also includes newlines, in my case, to find C-style if-expressions that have an opening brace after the close parenthesis like
if (..)
{
...
The command swiper-isearch understands \n in its minibuffer input and can match such multi-line patterns via for instance if ( ) \n { but counsel-projectile-rg can't with being fed the flag -U. It would be great if it did.
This call rg -U 'if \(.*\) *\n *\{' matches my needs
and in Elisp
(defuncounsel-projectile-rg-multiline ()
"Search the current project with rg pattern spanning multiple lines."
(interactive)
(counsel-projectile-rg "--multiline"))
with minibuffer input static if ( ) \n \{ works. Is it standard to have to backquote curly braces in Ivy/Projectile-style searches?
It's not needed with Swiper so I guess we shouldn't need to do that here either for interface consistency.
The text was updated successfully, but these errors were encountered:
I don't intensively search for regexps in ivy/swiper so am not sure whether it's standard to backquote curly braces. In any case I think counsel-projectile probably doesn't play any part in this because counsel-projectile-rg essentially relies on counsel-rg. You could confirm this by trying your search in counsel-rg.
The difference between counsel-rg and swiper-isearch could come from the way rg processes the regexp it receives from counsel-rg I imagine. Whether or not this is something that counsel-rg should address I don't know. I would suggest to submit the issue on the swiper repo.
I want to search for a regexp where the whitespace also includes newlines, in my case, to find C-style
if
-expressions that have an opening brace after the close parenthesis likeif (..) { ...
The command
swiper-isearch
understands\n
in its minibuffer input and can match such multi-line patterns via for instanceif ( ) \n {
butcounsel-projectile-rg
can't with being fed the flag-U
. It would be great if it did.I guess this is related:
https://til.hashrocket.com/posts/9zneks2cbv-multiline-matches-with-ripgrep-rg
Update:
This call
rg -U 'if \(.*\) *\n *\{'
matches my needsand in Elisp
with minibuffer input
static if ( ) \n \{
works. Is it standard to have to backquote curly braces in Ivy/Projectile-style searches?It's not needed with Swiper so I guess we shouldn't need to do that here either for interface consistency.
The text was updated successfully, but these errors were encountered: