Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searches with "#" blow up #5

Closed
jacquescrocker opened this issue Jun 28, 2010 · 14 comments
Closed

Searches with "#" blow up #5

jacquescrocker opened this issue Jun 28, 2010 · 14 comments

Comments

@jacquescrocker
Copy link

@jacquescrocker jacquescrocker commented Jun 28, 2010

I often need to search for strings that begin with "#" when finding id divs in haml/css

However Ack.vim explodes when using:

:Ack -Q "#something"

error:

E194: No alternate file name to substitute for "#"

ack -Q "#something" works fine from the command line so something in ack.vim is screwing it up

@mileszs

This comment has been minimized.

Copy link
Owner

@mileszs mileszs commented Jun 28, 2010

Can you tell me your operating system, version of ack/ack-grep, etc.? I can't recreate your issue.

@jacquescrocker

This comment has been minimized.

Copy link
Author

@jacquescrocker jacquescrocker commented Jun 28, 2010

Sure, I'm using MacVim Snapshot 52 along with OSX 10.6.4. Ack version is 1.92 (perl 5.10). I'll try it with my Terminal vim instead, maybe its just a macvim bug

@jacquescrocker

This comment has been minimized.

Copy link
Author

@jacquescrocker jacquescrocker commented Jun 28, 2010

Same issue in pure terminal vim (version 7.2.108)

@jacquescrocker

This comment has been minimized.

Copy link
Author

@jacquescrocker jacquescrocker commented Jun 29, 2010

Here's all my config settings (http://github.com/railsjedi/vimconfig). Let me know if you can repro with this setup. Thanks!

@blueyed

This comment has been minimized.

Copy link
Contributor

@blueyed blueyed commented Mar 25, 2011

The issue at hand is that '#' will get replaced with the alternate file name.
If you do not get E194 you'll have the alternative file name in that position instead.

You have to escape it like this :Ack '\\\#define foo' to search for #define foo.

I do not know if there is anything ack.vim could do about this to make it simpler (i.e. not require any escaping.

The same issue should apply to %, too.

@dxuehu

This comment has been minimized.

Copy link

@dxuehu dxuehu commented Nov 1, 2011

thank you. i thought i was going crazy (searching exactly for # and % strings...gah)

@ignovak

This comment has been minimized.

Copy link

@ignovak ignovak commented Jun 13, 2012

Have encountered this issue too. Escaping with '#' works, but I've spent some time to find it out:).
Perhaps, it'd make sense to mention this point in the doc.

@mileszs

This comment has been minimized.

Copy link
Owner

@mileszs mileszs commented Oct 15, 2012

Done.

@mileszs mileszs closed this Oct 15, 2012
svermeulen pushed a commit to svermeulen/ack.vim that referenced this issue Jul 16, 2013
svermeulen pushed a commit to svermeulen/ack.vim that referenced this issue Jul 16, 2013
dyng added a commit to dyng/ack.vim that referenced this issue Sep 7, 2013
Make necessary escapes as you can pass plain '#' or '%' now.
@Konfekt

This comment has been minimized.

Copy link
Contributor

@Konfekt Konfekt commented Jul 21, 2014

@blueyed, why the triple slash to escape #, does one not suffice?

@lkraav

This comment has been minimized.

Copy link

@lkraav lkraav commented Jul 21, 2014

I can confirm, triple is needed.

@Konfekt

This comment has been minimized.

Copy link
Contributor

@Konfekt Konfekt commented Jul 21, 2014

Ok. Is this under Linux? Still so if shellescape() is applied? I am wondering because # is not a special regex character.

@weakish

This comment has been minimized.

Copy link

@weakish weakish commented Nov 28, 2014

Is this under Linux? Still so if shellescape() is applied? I am wondering because # is not a special regex character.

@Konfekt This is under all platforms.
# is neither a special character in shell nor a special character in regex.
As @blueyed pointed out, vim treats # specially.
See :help expand for more information.

@Konfekt

This comment has been minimized.

Copy link
Contributor

@Konfekt Konfekt commented Nov 28, 2014

Ok, thank you. Now that I know about # as last buffer in the Vim command line it makes sense.

@Sean-Lan

This comment has been minimized.

Copy link

@Sean-Lan Sean-Lan commented May 9, 2015

Hi, guys. I have just tried that with my MacVim (version 7.4.622), and it seems that only one back slash is enough and when I input three, nothing will be found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.