Emacs之左膀右臂ripgrep(rg):隐藏搜索结果问题

当 Emacs 调用 counsel-rg 搜索关键词的时候,比如搜索 Interactive,过长的结果将会被折叠隐藏。

Emacs之左膀右臂ripgrep(rg):隐藏搜索结果问题

查看 counsel-rg, 发现命令是从 counsel-rg 内定义的。

(defun counsel-rg (&optional initial-input initial-directory extra-rg-args rg-prompt)
  "Grep for a string in the current directory using rg.
INITIAL-INPUT can be given as the initial minibuffer input.
INITIAL-DIRECTORY, if non-nil, is used as the root directory for search.
EXTRA-RG-ARGS string, if non-nil, is appended to `counsel-rg-base-command'.
RG-PROMPT, if non-nil, is passed as `ivy-read' prompt argument.

再查看 counsel-rg-base-command:

;;** `counsel-rg'
(defcustom counsel-rg-base-command
  (split-string
   (if (memq system-type '(ms-dos windows-nt))
       "rg -M 240 --with-filename --no-heading --line-number --color never %s --path-separator / ."
     "rg -M 240 --with-filename --no-heading --line-number --color never %s"))
  "Alternative to `counsel-ag-base-command' using ripgrep.

发现其问题在“-M”,` -M, --max-columns NUM`, 而 defcustom 是定义变量的另外一种方式,有 custom 和 set 两种方式设置:

Emacs之左膀右臂ripgrep(rg):隐藏搜索结果问题

从 配置中,将其修改为:

;; Editing - riggrep Search
(setq counsel-rg-base-command "rg --with-filename --no-heading --line-number --color never %s")

再次搜索其结果展示为:

Emacs之左膀右臂ripgrep(rg):隐藏搜索结果问题

如此,则大功告成。

展开阅读全文

页面更新:2024-03-07

标签:左膀右臂   大功告成   变量   搜索关键词   命令   定义   方式   发现   科技

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top