T4ng10r
T4ng10r

Reputation: 809

VIM on Windows fails to execute grep with regex patterns


When I worked on Linux I've created set of greps shortcuts which I used frequenlty. like

command! GrepFaults :%!grep -a -E '(newAlarm Id)|\bE?[Ff]aultI[dD]|updateAlarmCounter'

However when I executed this on Windows I received E4895 errors

E484: Can't open file C:\Users\tanglor\Appdata\Local\Temp[\VIo112B.tmp

When I change ' to " - then gVim hangs waiting for terminal command to complete

C:\Windows\system32\cmd.exe /c (grep -a -E ^"^(newAlarm Id^) ^<C:\Users\tanglor\AppData\Local\Temp\VIi434C.tmp ^|\bE?[Ff]aultI[dD]^|updateAlarmCounter^" ^>C:\Users\tanglor\AppData\Local\Temp\VIo434D.tmp 2^>^&1)

C:\Users\tanglor\AppData\Local\Temp\VIi434C.tmp contain buffer on which I currently work.
gVim internals has problem with keeping grep regex command as one command, he inserts input where second part of regext alternative should be.
I tried to escape pipe (|) with ^ char or **** char - no result.

I can use Windows findstr, but I would like to keep my vim files coherent. I believe that I may need some extra escape character.

Can you help solve this?

Upvotes: 0

Views: 236

Answers (0)

Related Questions