Ack.vim “没有这样的文件或目录” Windows 上的错误
不久前,我在我的 Windows XP 机器上安装了 Ack,并且与 Vim 一起工作得很好。不确定我最近做了什么,但现在不起作用了。
这是我在 Vim 中遇到的问题的一个示例:
:Ack searchterm
返回此错误消息:
ack: searchterm: No such file or directory
如果我尝试在 Vim 中“手动”运行命令:
:!ack searchterm
这将打开一个 cmd.exe 对话框,其中包含以下消息:
C:\WINDOWS\system32\cmd.exe /c ack searchterm
ack: searchterm: No such file or directory
shell returned 1
Hit any key to close this window....
仍然没有运气。
奇怪的是,如果我转到 START >运行
,然后输入此命令:
cmd.exe /c ack searchterm
它工作正常,Ack 愉快地搜索 searchterm
我不明白。 Vim 调用 cmd.exe 的方式与我通过 run
调用它的方式有何不同 - 结果应该与我想象的相同。
有什么想法吗?
更新:
我现在知道消息“没有这样的文件或目录”是因为 Ack 认为我正在运行这种格式的 ack 命令:
ack searchterm filename
其中 filename 是您要搜索的文件。问题是我没有提供文件名 - 所以我不确定为什么它认为我的搜索词实际上是要搜索的文件。
不知何故 vim 将参数错误地传递给 cmd.exe - 但我只是不明白它是如何做的那
更新 2
Vim 不是问题。一定是我的 Ack 版本被搞乱了。
如果我打开 cmd.exe 并输入以下内容:
ack searchterm
然后我还会收到错误消息:
ack: searchterm: No such file or directory
如果我只是输入 ack:
ack
那么它就会开始搜索...寻找某些东西...谁知道什么
这不是我在两个示例中所期望的。但我一定会越来越近...
I had Ack setup and working fine with Vim on my windows XP machine not long ago. Not sure what I did recently, but now it doesn't work.
Here is an example of my problem in Vim:
:Ack searchterm
Returns this error message:
ack: searchterm: No such file or directory
If I try to run the command 'manually' in Vim:
:!ack searchterm
Which opens a cmd.exe dialog with the following message in it:
C:\WINDOWS\system32\cmd.exe /c ack searchterm
ack: searchterm: No such file or directory
shell returned 1
Hit any key to close this window....
Still no luck.
What is weird, is if I go to START > Run
and then type this command:
cmd.exe /c ack searchterm
It works fine, and Ack happily searches away for searchterm
I don't get it. How can the way Vim calls cmd.exe be any different to how I am calling it via run
- the result should be the same I would have thought.
Any ideas?
UPDATE:
I now know the message "No such file or directory" is because Ack thinks I am running this format of the ack command:
ack searchterm filename
Where filename is the file you want to search in. The problem is that I'm not providing a filename - so I'm not sure why it thinks my searchterm is actually the file to search in.
Somehow vim is passing the arguments incorrectly to cmd.exe - but I just can't see how it could do that
UPDATE 2
Vim is not the problem. It must be my version of Ack is buggered somehow.
If I open up cmd.exe and type this:
ack searchterm
then I also get the error message:
ack: searchterm: No such file or directory
If I just type ack:
ack
then it starts searching... for something... who knows what
That is not what I would expect in both examples. I must be getting closer though...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,我解决了。我的 .ackrc 文件被破坏了。显然这是无效的语法:
正确的语法是:
为什么会导致我不知道的错误。但这才是罪魁祸首。
OK, I worked it out. My .ackrc file was borked. Apparently this is invalid syntax:
The correct syntax is:
Why the heck that would cause the error I don't know. But that was the culprit.
干得好。我使用 linux (crunchbang) 从 ack 中得到了同样的错误。
结果我已经从 Windows 复制了我的 ~/.ackrc 文件。
用旧的 dos2unix 修复了它。
Nice work. I was getting the same error from ack using linux (crunchbang).
Turned out I had copied my ~/.ackrc file over from Windows.
Fixed it with good old dos2unix.