ctrlf
ctrlf copied to clipboard
Support char folding
Hello,
It seems that ctrlf doesn't support char-fold-to-regexp search mode (see search-default-mode). It would be lovely to get support of this feature as it helps searching text with diacritical marks. For example, consider the following buffer:
Bună dimineața
Buna dimineata
With isearch typing buna matches both variants, while ctrlf matches only the last one.
You can read more about this feature in the documentation of char-fold-to-regexp function or in pretty old post by Artur Malabarba.
Thanks in advance :)
As a workaround, I define the following as my default style. But this doesn't apply char fold when switching to alternate ctrlf styles.
(defun aj/ctrlf-translate-fuzzy-char-fold (input)
(ctrlf-translate-fuzzy-regexp (char-fold-to-regexp input)))
(add-to-list
'ctrlf-style-alist
'(fuzzy-char-fold
. (:prompt "fuzzy CF"
:translator aj/ctrlf-translate-fuzzy-char-fold
:case-fold ctrlf-no-uppercase-literal-p
:fallback (isearch-forward . isearch-backward))))
(setq ctrlf-default-search-style 'fuzzy-char-fold)