Skip to content

More context in emacs grep buffers

Notifications You must be signed in to change notification settings

emacs-pe/grep-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

ARCHIVED: I won’t maintain this package anymore.

grep-context.el

https://melpa.org/packages/grep-context-badge.svg

Emacs package for more context in compilation/grep buffers. Works with wgrep, ack, ag, ivy, ripgrep.

./demo.gif

Table of contents

Installation

From Melpa

Use M-x package-install RET grep-context RET to install this package.

Manual

Install dash, then put path to grep-context.el in your load path:

(add-to-list 'load-path "<path-to-dir-containing-grep-context.el>")

Usage

To insert context lines around match at point, call grep-context-more-around-point. To kill context lines, call grep-context-less-around-point.

These commands take a prefix argument that says how many lines to insert or kill.

The easiest way to enable keybindings for these commands in all compilation buffers is to use grep-context-mode, where they’re bound to + and - keys:

(add-hook 'compilation-mode-hook #'grep-context-mode)

Extension

This package will work with any compilation buffer except it needs to know how to format context lines. If you want to use it in your mode, you can add an entry to grep-context-line-format-alist. You can also add an entry to grep-context-separator-alist to specify a separator for non-contiguous regions of context.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.