Open chaoyi opened 3 years ago
Does swiper has functionality to restrict candidates by filtering out matches?
Yes, by default anything following a !
negates the match, e.g. foo ! bar
matches lines that include foo
but not bar
.
See (info "(ivy) Completion Styles")
and its subnodes.
Wait, why not foo bar!
syntax?
Wait, why not
foo bar!
syntax?
Because the author didn't design it that way, of course. ;) Why would you expect foo bar!
to work?
If you want that syntax, I think you'd need to add a custom matcher to ivy-re-builders-alist
. One downside of it would be that you presumably have to append !
to every pattern you want to negate, whereas with infix foo ! bar baz
you can specify multiple patterns to negate.
I wanted to have two keybindings
(map! :map ivy-minibuffer-map
"C-r" #'ivy-restrict-to-matches
"C-w" #'ivy-restrict-to-matches-negative)
In this way, I can visualize negative matches while typing.
Maybe one keybinding, but if repeated negate to positive
I want to add a function called ivy-restrict-to-matches-negate
. It acts the same as ivy-restrict-to-matches
but for non-matches. It is useful for searching variables.
Sorry, I misunderstood; reopening.
Does swiper has functionality to restrict candidates by filtering out matches? Currently I am using
swiper-thing-at-point
andivy-restrict-to-matches
once or multiple times to search symbols interactively. That maybe could be an alternative to fzf's extended mode.