Yes! Emacs has built-in support for running grep
and navigating results via grep-mode
, but if you're looking for a smarter, more context-aware grep experience integrated seamlessly into your workflow, you might want to check out repo-grep
.
repo-grep
is an Emacs Lisp tool designed specifically to make searching within Git or SVN repositories easier and faster. Here’s what makes it stand out:
Context-aware search: It automatically uses the word under your cursor as the default search term, so you don’t have to type it manually every time.
Interactive term editing: You can tweak the search term on the fly, add regular expressions, or suffixes to refine your searches.
Multi-repository search: You can run repo-grep-multi
to search across multiple repositories or folders within the same parent directory.
Exclusion filters: Easily ignore irrelevant files like logs or temporary files, which keeps your results clean.
Easy navigation: Like standard grep-mode
, you can jump directly to any match found in the search results.
To get started, just add the repo-grep.el
file to your Emacs load path and bind a key (e.g., F12
) to invoke repo-grep
. For example:
(add-to-list 'load-path "/path/to/repo-grep")
(autoload 'repo-grep "repo-grep")
(global-set-key [f12] 'repo-grep)
Then place your cursor on a word and hit F12
—repo-grep
will search your repository for that word, and you can jump to any of the matches right away.
This tool enhances your search workflow by combining the power of grep
with smart defaults and repository awareness, saving you time and keystrokes.
You can find the project here: https://github.com/BHFock/repo-grep