What is the best Find in File mode for EMACS?

What is the best package to search for strings in multiple files in EMACS. I know about grep and such, but I would like a little smoother to work with.

+4
source share
5 answers

Just in case, if you have not read it yet , many relevant tips have appeared on the EmacsWiki GrepMode page.

+2
source

There are three built-in functions for grepping in Emacs: grep, find-grep (or grep-find) and rgrep.

The first two works allow the user to directly edit the grep command line. I usually use the third, rgrep, from "recursive grep". It is a little friendlier, as it offers the user search options (search bar, file types and directory) one by one, provides custom defaults and automatically ignores some common files and directories that usually do not need to be searched, such as .svn or .o files.

Then there is ack and its interface for Emacs: ack.el , whose default behavior is similar to rgrep, but can be configured to use the options that ack provides.

+7
source

Dired mode also allows you to search for marked files using the dired-do-search function.

And ibuffer allows ibuffer to perform a general search for is emacs through a bunch of buffers using the awkward key sequence Ms a Cs .

0
source

As an alternative, I find dired-mode useful, especially when used with dired-mark-files-regexp ( % m ) or dired-mark-files-containing-regexp to select what to look for and then dired-do-search ( A ).

0
source

Depends on what you mean by finding the string. As others have noted, grep very good at what it does. I use it all the time, every day.

But if your β€œstring” is, say, a sequence of words inside a sentence (which can be multi-line), then grep may not be what you need.

Another tool for searching across multiple files or buffers (or bookmarks) is Icicles search. The general idea is that it first analyzes the files in the search contexts according to some definition (for example, regexp), and then searches for matches with the current minibuffer input (the search changes dynamically as you edit your input).

While grep always uses strings as search contexts, when searching for Icicles, you are not limited by how you define contexts for the search. Contexts should not share (exhale) a file; they can cover as much or less file text as you want.

Among other features, you can use Emacs point definitions for various THING types as search contexts. For example, you can use the icicles-search-thing command with sentence as a type of THING to use sentences as search contexts.

Or you can use symbol property zones as search contexts: for example, search for all zones that are locked in a font with a given set of faces. There are many possibilities.

http://www.emacswiki.org/emacs/Icicles_-_Search_Commands%2c_Overview

0
source

Source: https://habr.com/ru/post/1310541/


All Articles