Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Vim plugin doesn't support capture groups?

I'm beginning to use IntelliJ with the vim plugin, and found that commands as simple as

/case (.*)

fail to return any results. Of course, that's not a very useful command. I'd like to reverse the order of all of the elements of my table by executing

:'<,'>s/case (\w*): return (\w*);/case \2: return \1;/

but that also failed to match anything. I tried a few different search regexes and all of them worked as long as there were no capture groups.

Does IntelliJ Vim support capture groups like these? Are there special characters I need to escape to get it to work? I know the builtin search and replace gui lets you do logic with backreferences, but I'd like to do my work right from the command line.

like image 972
Alex Sage Avatar asked Oct 28 '25 12:10

Alex Sage


1 Answers

This wouldn't even work in Vim to begin with.

(\w*) is not a capture group; it will match a literal opening parenthesis, followed by any number of any keyword character, followed by a literal closing parenthesis.

\(\w*\) is an actual capture group… which will work both in Vim and in IdeaVim.

like image 164
romainl Avatar answered Oct 30 '25 07:10

romainl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!