search - 无法在 Emacs 中有效搜索

标签 search emacs

我想在 Emacs 中有一个类似于 Vim 中的工具

 :g/search/

获取匹配列表。

如何在 Emacs 中获得匹配列表?

最佳答案

M-x occur ?
来自 the manual :

M-x occur

Prompt for a regexp, and display a list showing each line in the buffer that contains a match for it. The text that matched is highlighted using the match face. To limit the search to part of the buffer, narrow to that part (see Narrowing). A numeric argument n specifies that n lines of context are to be displayed before and after each matching line. The default number of context lines is specified by the variable list-matching-lines-default-context-lines.

In the *Occur* buffer, you can click on each entry, or move point there and type RET, to visit the corresponding position in the buffer that was searched. o and C-o display the match in another window; C-o does not select it. Alternatively, you can use the C-x ` (next-error) command to visit the occurrences one by one (see Compilation Mode).

Typing e in the *Occur* buffer switches to Occur Edit mode, in which edits made to the entries are also applied to the text in the originating buffer. Type C-c C-c to return to Occur mode.

The command M-x list-matching-lines is a synonym for M-x occur.

关于search - 无法在 Emacs 中有效搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/908286/

相关文章:

Java:从 Lucene Hits 到原始对象

emacs - 如何在emacs中使用向后删除单词而不是向后杀死单词

html - 如何删除输入div生成的框?

Javascript 产品搜索(有效,但需要按搜索词过滤)

Emacs Lisp 数字运算(实际上,简单的加法)

用于 emacs 的 Vim 蛋糕配色方案

emacs - 无法隐藏 Emacs 中的欢迎屏幕

emacs - Aquamacs 和 IDLWAVE

python - 在 Python 中,如何找到排序列表中第一个大于阈值的值的索引?

用于解析类似 Google 的搜索运算符的 PHP 库?