Closed chiefjester closed 5 years ago
You need a trailing slash. ie. :Acks /foo|bar/baz/
Surprised it didn't show an error.
Depending on your 'magic'
Vim setting you may need to escape the |
too (\|
). Whatever you write gets passed through as-is to Vim as though you had written a :s
command.
hey @wincent big fan here! Thanks for checking, but yeah, I just forgot to add a slash on the comment, but when I tried it it won't work.
sorry @wincent I didn't see your comment about magic setting
So my Acks should be like this? (need to add \v) ?
:Acks /\vfoo|bar/baz/
Also I was wondering, if Acks is using :cfdo under the hood, isn't
"very magic" mode for vim is the most compatible with perl compatible and should be the default? That way it's a better partner for ag,ack,rg's regex since they more or less share the similar regex engine? Would you be open for a PR to make it default for <Leader>r
?
I guess this is where we set that? https://github.com/wincent/ferret/blob/master/plugin/ferret.vim#L676-L677
Personally, I think "very magic" makes the most sense (Vim's idiosyncratic regular expressions drive me up the wall), but I am reluctant to ~tamper with~ manipulate people's defaults too much. I do that in the Loupe plugin, for example, but it is gated behind an option.
It's true that we could make the mapping prepend it by default, but I would probably want it to have an option for it.
I'm pro for making very magic
default as well. I'm coming from from a vimgrep workflow where I can test my regex in search do a :cfdo s/<C-r>//
after.
I wish vim plugins have semver, that way you can iterate over major versions and won't need to worry about breaking other people's workflow.
However, using very magic
actually makes it closer to perl compatibility and would actually be an improvement rather than a regression.
But I do respect your reluctance. Perhaps some compromise of having a gated option as well? So that people can opt-in for the very magic? (If making it a default is a non option). We could also have a gate where users can use legacy bindings too?
I think it's probably ok to change the default even though people tend not to pay attention to semver, for a couple reasons:
:Acks /\v...//
instead of :Acks /...//
).I pushed a draft implementation of this to the "next" branch. I'll test it for a while there and if all looks good will merge that into "master".
sweet thanks for the update @wincent!
If I try to do
:Ack foo|bar
then
:Acks /foo|bar/baz/
It doesn't update anything?