helm如何实现用拼音首字母搜索

如果你说的是helm-buffers-list,可以试试下面的代码(用的是pinyinlib

              (setq zjy/helm-match-in-pinyin t)

              (defun zjy/pinyin-match (pattern candidate)
                (let ((case-fold-search t))
                  (if zjy/helm-match-in-pinyin
                      (string-match (pinyinlib-build-regexp-string pattern) candidate)
                    (string-match pattern candidate))))

              (defun zjy/helm-buffer--match-pattern (pattern candidate &optional nofuzzy)
                (let ((bfn (if (and helm-buffers-fuzzy-matching
                                    (not nofuzzy)
                                    (not helm-migemo-mode)
                                    (not (string-match "\\`\\^" pattern)))
                               #'helm-buffer--memo-pattern
                             #'identity))
                      (mfn (if helm-migemo-mode
                               #'helm-mm-migemo-string-match #'zjy/pinyin-match)))
                  (if (string-match "\\`!" pattern)
                      (not (funcall mfn (funcall bfn (substring pattern 1))
                                    candidate))
                    (funcall mfn (funcall bfn pattern) candidate))))

              (advice-add #'helm-buffer--match-pattern :override #'zjy/helm-buffer--match-pattern)

PS. 就支持拼音过滤这点来说,ivy/selectrum就要方便多了,很容易改变filter函数。