Vim: grep wildcard not working in windows

I am trying to use vim internal grep with a wildcard '**', as in the following command:

grep "test" **\*.txt

vim gives the following error:

FINDSTR: Cannot open **\*.txt

When I delete the template '**', the command works correctly:

grep "test" *.txt

I changed the backslash to forward slashes, but that didn't help anything:

grep "test" **\*.txt

This again leads to the above error.

What could be the reason?

Note. I am using GVim 7.2 in Microsoft Windows XP.

+5
source share
6 answers

": grep" Vim XP "grep.exe" . "FINDSTR", Windows. "FINDSTR" grep.

FINDSTR: Cannot open **\*.txt

. ": help grepprg".

grep Windows, grep Windows, Vim .

7.0 Vim grep, vimgrep. . ": Help vimgrep".

'grepprg' , grep vimgrep ( FINDSTR ).

+5

cygwin, mingw, unxutils, grep ( cygwin). bin PATH.

, vimrc:

set grepprg=grep\ -nH

( , grep on * nix.)

, :help grep, grep vimgrep. ( .)

+2

vimgrep.

+1

Windows, findstr,

set grepprg=findstr\ /n\ /s

.vimrc

:vimgrep methodname **/*.py

:grep methodname *.py

, quickfix (:copen, :cn/:cp, :cclose)

findstr 30 , vimgrep, , vimgrep .

+1

: grep vim internal grep ( : vimgrep), grep.

(.. MinGW Cygwin grep), vimrc, .

set grepprg=C:/MinGW/msys/1.0/bin/egrep\ -nR\ $*\ *

"$" - , " " . Grep , . -n -R , vimgrep (, patter ).

0
source

** extends by an external tool specified in 'grepprg', or in the case of Windows, and not decrypted, since grepprg is just the findstr tool.

But any arguments you pass on the Vim command line also go to the tool, so just do a recursive search for findstr:

:grep /S pattern *.txt
0
source

All Articles