Search code examples
windowsvimcmdack

Ack.vim "No such file or directory" error on windows


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...


Solution

  • OK, I worked it out. My .ackrc file was borked. Apparently this is invalid syntax:

    --type-set
    coffeescript=.eco,.coffee
    plsql=.tab,.bdy,.spc,.seq,.tps,.trg,.prc,.vw,.fnc,.syn
    

    The correct syntax is:

    --type-set
    coffeescript=.eco,.coffee
    --type-set
    plsql=.tab,.bdy,.spc,.seq,.tps,.trg,.prc,.vw,.fnc,.syn
    

    Why the heck that would cause the error I don't know. But that was the culprit.