首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >搜索不使用isearch-face

搜索不使用isearch-face
EN

Stack Overflow用户
提问于 2013-07-03 19:27:04
回答 1查看 151关注 0票数 1

如何才能使用更可见的搜索面,或者至少突出显示找到的整个令牌呢?

一个闪烁的光标将是另一种选择,如果它不是如此分散编辑的注意力。

重述

如果我在字符串"hello“上运行isearch-forward,则在搜索过程中突出显示该字符串,如下面的图像所示。

如果我处于dired(-x)模式,则标记该文件,如下一个图所示,

然后在字符串"hello“上运行dired搜索,找到字符串,但不会突出显示,如下所示。

我怎样才能让搜索使用相同的脸作为搜索前进?在本例中,很容易发现光标,但在较大的显示器上大量使用字体锁定,并且在选择了一个比较温和、不突出的光标后,就很难发现搜索字符串的位置。

更新

下面的答案是解决这个问题的最简单的方法吗?

EN

回答 1

Stack Overflow用户

发布于 2013-07-04 02:53:01

也许你在找dired-do-isearchdired-do-isearch-regexp

如果您想要dired-do-search的相同感觉,看起来您还可以使用自定义tags-loop-operatetags-loop-scan操作调用tags-loop-continue

我想出的是:

代码语言:javascript
复制
(defvar dired-do-search-overlay nil)
(defvar dired-do-search-region nil)
(defun dired-do-search (regexp)
  "Search through all marked files for a match for REGEXP.
Stops when a match is found.
To continue searching for next match, use command \\[tags-loop-continue]."
  (interactive "sSearch marked files (regexp): ")
  (setq 
   tags-loop-operate `(progn 
            (if dired-do-search-overlay
                (delete-overlay dired-do-search-overlay))
            (setq dired-do-search-overlay 
                  (make-overlay (car dired-do-search-region)
                        (cadr dired-do-search-region)))
            (overlay-put dired-do-search-overlay
                     'face isearch-face)
            (overlay-put dired-do-search-overlay
                     'priority 1001)    
            nil)
   tags-loop-scan `(progn
             (if (re-search-forward ',regexp nil t)
             (setq dired-do-search-region 
                   (list (match-beginning 0)
                     (match-end 0)))
               (if dired-do-search-overlay 
               (delete-overlay dired-do-search-overlay))
               nil)))
  (tags-loop-continue 
   (or '(dired-get-marked-files nil nil 'dired-nondirectory-p) t)))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17456535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档