Vim:grep的通配符在windows中不起作用 [英] Vim: grep's wildcard doesn't work in windows
问题描述
我尝试在'**'
通配符中使用vim的内部grep,如下面的命令所示:
greptest** \ * .txt
vim给出以下错误:
FINDSTR:无法打开** \ * .txt
当我删除'**'
通配符时,该命令正常工作:
greptest* .txt
我将反斜杠改为正斜杠,但它也没有帮助:
greptest ** \ * .txt
再次出现上述错误。
可能是什么原因?
注意:我在Microsoft Windows XP上使用GVim 7.2。
在XP下的Vim中执行:grep时默认不使用grep.exe
。默认使用FINDSTR,它是Windows安装的
部分。 FINDSTR与grep不兼容
。因此,您收到错误消息
FINDSTR:无法打开** \ * .txt
请参阅:help grepprg。
如果您想使用Windows的grep端口你必须安装
它既然grep既不是Windows的一部分,也不是Vim
的安装。
一个名为vimgrep的内部grep。
请参阅:help vimgrep获取详细信息。
您必须相应地设置'grepprg',以便使用
grep或vimgrep的默认FINDSTR)。
I try to use vim's internal grep with '**'
wildcard as in the following command:
grep "test" **\*.txt
vim gives the following error:
FINDSTR: Cannot open **\*.txt
When I remove the '**'
wildcard, the command works properly:
grep "test" *.txt
I changed the backslashes to forward slashes, but it didn't help neither:
grep "test" **\*.txt
This gives the above error again.
What might be the reason?
Note: I use GVim 7.2 on Microsoft Windows XP.
Doing a ":grep" in Vim under XP does not use "grep.exe" by default. By default "FINDSTR" is used which is part of the Windows installation. "FINDSTR" is not compatible to grep. Due to this you get the error message
FINDSTR: Cannot open **\*.txt
See ":help grepprg".
If you want to use a Windows port of grep you have to install it since grep is neither part of Windows nor of the Vim installation.
But since 7.0 Vim has an internal grep called vimgrep. See ":help vimgrep" for details.
You have to set 'grepprg' accordingly so that either grep or vimgrep is used (instead of the default FINDSTR).
这篇关于Vim:grep的通配符在windows中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!