hlissner/evil-snipe

Possible to support char-fold-to-regexp option like search-default-mode?

sooheon opened this issue · 2 comments

With the release of 25.1, there is a new option for isearch to search not only for literal characters, but ASCII equivalents. It would be nice if snipe searches can support this.

'isearch' and 'query-replace' can now perform character folding in matches.
This is analogous to case folding, but instead of disregarding case
variants, it disregards wider classes of distinctions between similar
characters.  (Case folding is a special case of character folding.)
This means many characters in the search string will match entire
groups of characters instead of just themselves.

For instance, the ASCII double quote character " will match all
variants of double quotes, and the letter 'a' will match all of its
accented cousins, even those composed of multiple characters, as well
as many other symbols like U+249C (PARENTHESIZED LATIN SMALL LETTER
A).

Character folding is enabled by customizing 'search-default-mode' to
the value 'char-fold-to-regexp'.  You can also toggle character
folding in the middle of a search by typing 'M-s ''.

'query-replace' honors character folding if the new variable
'replace-char-fold' is customized to a non-nil value.

Good idea. I'll look into this.

I've added char-fold support, but it's experimental. You can enable it with (setq evil-snipe-char-fold t).

It seems to work fine, but let me know if you encounter any corner cases.