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

Improve back-slash handling to reduce confusion #41

Closed
xbot opened this Issue Feb 19, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@xbot
Copy link

xbot commented Feb 19, 2017

Either :Ack App\\\Link or :Ack App\\\\Link will find App\Link.

Why ? Won't it be easier to be understood with :Ack App\\Link ?

@wincent

This comment has been minimized.

Copy link
Owner

wincent commented Feb 28, 2017

You should be confused because it is confusing. There are multiple levels of escaping happening here, I think:

  • The shell in which the ack/ag command performs escaping.
  • The ack/ag performs Perl-Compatible Regular Expression escaping too.

I think the shell in particular makes this tricky to understand, as evidenced by this Stack Exchange post.

@xbot

This comment has been minimized.

Copy link

xbot commented Mar 1, 2017

@wincent Thanks. Now I understand what happened. The other question is, won't it be more readable for the inputed regular expression if Ferret do the extra escaping ?

@wincent

This comment has been minimized.

Copy link
Owner

wincent commented Mar 2, 2017

That's an interesting idea. If it could be done reliably, that would be great. Having to be aware of the complicated escaping rules definitely makes the current set-up a leaky abstraction.

The only "gotcha" I can think of here is that depending on which mode Ferret is running in (using modern vim "async" primitives, using the vim-dispatch plug-in, or falling back to the legacy code path), the exact method used to launch the underlying tool may vary, so the escaping requirements may be different. We'd want to look into that to be sure that all the cases are correctly handled.

@wincent wincent changed the title I'm confused about the back slashes Improve back-slash handling to reduce confusion Mar 2, 2017

@wincent wincent added the enhancement label Mar 2, 2017

@xbot

This comment has been minimized.

Copy link

xbot commented Mar 2, 2017

@wincent Yeah, I'm looking forward to that.

@wincent

This comment has been minimized.

Copy link
Owner

wincent commented Jun 9, 2017

I think I have this working fairly nicely now on the "next" branch. Have tested with async Neovim, async Vim 8, and vanilla (non-async) Vim-8. Haven't bothered to test with vim-dispatch, yet, but I will. If I haven't run into any issues with this in a few days, will merge to master.

@wincent wincent closed this in 10ed8e0 Jun 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment