如何开启 Fuzzy Search

SPC P F 不能 fuzzy search 吗?find-in-project 也不可以诶(所有的 Pattern 都没有 fuzzy search

  dotspacemacs-helm-use-fuzzy 'always

这样在 init.el 中不是应该默认就已经是开启 fuzzy 了吗?所有的输入都没有 fuzzy 补全了?(记得以前是有的)

能否举例说明你想要的fuzzy match应该是什么样子的?

比如像 sublime 的 control p 一样的,我记得以前的 m-x 也是有 fuzzy search 的。比如输入 cl 可以找到 control。

我就奇怪看视频的时候怎么一句都不提这个,还有貌似spacemacs的默认配置也不支持,其实这东西在vim上已经非常普遍了,补全和文件搜索都支持fuzzy search,emacs的helm去年也支持。

(use-package helm
:init
(setq helm-semantic-fuzzy-match t)
(setq helm-recentf-fuzzy-match t)
(setq helm-locate-fuzzy-match t)
(setq  helm-M-x-fuzzy-match t)
(setq helm-imenu-fuzzy-match t)
(setq helm-buffers-fuzzy-matching t)
(setq helm-mode-fuzzy-match t)
(setq helm-completion-in-region-fuzzy-match t)
)
2 个赞

这个我搜到了,我只是记得我用 spacemacs 的时候是是可以模糊搜索的,就来确认一下。

你提供的这几个变量在我的 Emacs 中并不是所有都存在,

  (setq helm-M-x-fuzzy-match t)
  (setq helm-imenu-fuzzy-match t)
  (setq helm-semantic-fuzzy-match t)

上面这三个变量不存在,是因为我 helm 的版本不对吗?

Github 版本有这个变量,我重装下看看有没有变化。

dotspacemacs-helm-use-fuzzy 'always

这个变量是 2.0 新加入的,可能有 bug 吧?

肯定啊,helm这个包有很多扩展,搜文件,搜buffer…搜imenu…这些搜索都可以配置fuzzy或者不fuzzy

我怎么才能添加这些扩展呢?

抱歉我也是菜鸟,这些信息我是从helm的仓库的wiki找到的helm,配置后实际可用,还有你想实现你那个st编辑器的搜索功能我还用了,另外一个包叫做

(use-package helm-projectile
:ensure t
:init
(setq helm-projectile-fuzzy-match t)
(helm-projectile-on)
)

这是按键映射,

  (define-key evil-normal-state-map "\C-p" 'helm-projectile)
(define-key evil-normal-state-map "\C-l" 'helm-projectile-recentf)
(define-key evil-normal-state-map "\C-j" 'helm-projectile-switch-to-buffer)
(define-key evil-normal-state-map "\C-k" 'helm-semantic-or-imenu)
1 个赞

解决了 SPC p F 大写的 F 都是 helm 的搜索 小写则是 counsel-find