怎样给 Ivy 添加拼音支持

我现在更新了我的拼音搜索设置,有兴趣的可以试试,中文英文同时搜出,支持首字母搜索或者全拼搜索

(use-package pyim
  :after ivy
  :config

  (defun eh-ivy-cregexp (str)
    (let ((a (ivy--regex-plus str))
          (b (let ((case-fold-search nil))
               (pyim-cregexp-build str))))
      (if (and a (stringp a))
          (concat a "\\|" b)
        a)))

  (setq ivy-re-builders-alist
        '((t . eh-ivy-cregexp))))
6 个赞