分享一下这个周末折腾 selectrum-mode Icomplete-mode mini-frame 以及rg.el的一些心得

https://www.reddit.com/r/emacs/comments/f972tf/weekly_tipstricketc_thread/fiyght7?utm_source=share&utm_medium=web2x

看到以上一个帖子一个视频,决定折腾一下,替换掉我的ivy . 虽然ivy提供的功能我很喜欢。 但觉得它的api设计的实在是烂,以后的发展不是很看好,所以决定把它换掉。

总结下下 目前Icomplete-mode 让我不爽的有两点

  1. 不支持空格分隔关键词,目前借助 Any plan to implement completion style · Issue #54 · radian-software/prescient.el · GitHub 可以实现,但是高亮的处理我不知道怎么解决,提了个issue 看看后续什么情况,另外提一下prescient.el 是selectrum-mode也使用prescient.el 进行过滤筛选) 不过Icomplete-mode 目前已经支持flex/fuzzy方式的过滤,喜欢flex/fuzzy方式的可以无视这一条。
  2. "{"之前的promp及输入的内容在candidates比较多的时候会被隐藏掉,尤其是竖着展示的时候,这个很烦人.

selectrum-mode
优点是

  1. 支持helm/ivy那种按空格分词后再匹配的算法
  2. 代码优雅简洁
  3. 运行candidates为多行的情况,(这点一开始以为它不支持,见 Issues · radian-software/selectrum · GitHub

mini-frame 则是将minibuffer放到一个单独的frame进行展示,目前来看还是挺好用的。

成果在这里 vmacs/conf/conf-minibuffer.el at master · jixiuf/vmacs · GitHub

使用rg.el 主要是替代counsel-rg 命令,文档很全,功能也很强大,我之前对counsel-rg命令做过魔改,主要支持以下功能,目前来看使用rg.el都实现了。

  1. 可以在当前路径进行搜索
  2. 在git 根目录进行搜索,
  3. 支持wgrep/iedit
  4. 在保存的occur buffer后,支持继续进行过滤(隐藏匹配的行,只显示匹配的行,类型于 rg .|grep hello |grep -v world 成果在这果 vmacs/conf/conf-rg.el at master · jixiuf/vmacs · GitHub

附上3个库的链接 ,Icomplete-mode 是emacs自带的

4 个赞

那个reddit里有人提到另一个用childframe显示minibuffer的包,

感觉也不错。

不过我现在过了那个劲以后已经不是那么热衷于childframe了。现在更喜欢terminal/UI通用的功能。

1 个赞

目前所有关于 minibuffer 的 child-frame 包,都有或多或少的问题,使用都不够舒心。为了达到统一的体验,我暂时都不用这些包了。

slecttrum 的功能还是太弱了,等生态好了再看看。@jixiuf 你说的 ivy api 烂,具体是指什么呢?

1 个赞

楼主写的 helm-etags+, 还有 etags-update, 我直到现在还在用, 编辑时自动更新 TAGS, 真心省心. :+1:

这个包似乎解决了之前说的问题。

This package defines a global minor mode to display Icomplete completion candidates vertically. You could get a vertical display without this package, by using (setq icomplete-separator "\n") , but that has two problems which icomplete-vertical-mode solves:

  1. Usually the minibuffer prompt and the text you type scroll off to the left! This conceals the minibuffer prompt, and worse, the text you enter.
  2. The first candidate appears on the same line as the one you are typing in. This makes it harder to visually scan the candidates as the first one starts in a different column from the others.

是, 最近已经完全转用icomplete-mode了 , 配合 GitHub - oantolin/orderless: Emacs completion style that matches multiple regexps in any orderGitHub - oantolin/icomplete-vertical: Global Emacs minor mode to display icomplete candidates vertically 已经很好用了。 期待他们能合到emacs主干去,

看来icomplete-vertical快要合并到master分支了。
https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00093.html

没人用 fido-mode 吗?