Coder Social home page Coder Social logo

emacsmirror / wgrep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mhayashi1120/emacs-wgrep

1.0 2.0 0.0 304 KB

Writable grep buffer

Home Page: http://github.com/mhayashi1120/Emacs-wgrep/raw/master/wgrep.el

License: GNU General Public License v3.0

Emacs Lisp 97.02% Makefile 2.66% Shell 0.31%

wgrep's Introduction

wgrep.el

Summary:

wgrep allows you to edit a grep buffer and apply those changes to the file buffer like sed interactively. No need to learn sed script, just learn Emacs.

Install:

Put this file into load-path'ed directory, and byte compile it if desired. And put the following expression into your ~/.emacs.

(require 'wgrep)

Usage:

You can edit the text in the grep buffer after typing C-c C-p . After that the changed text is highlighted. The following keybindings are defined:

  • C-c C-e: Apply the changes to file buffers.

  • C-c C-u: All changes are unmarked and ignored.

  • C-c C-d: Mark as delete to current line (including newline).

  • C-c C-r: Remove the changes in the region (these changes are not applied to the files. Of course, the remaining changes can still be applied to the files.)

  • C-c C-p: Toggle read-only area.

  • C-c C-k: Discard all changes and exit.

  • C-x C-q: Exit wgrep mode.

  • To save all buffers that wgrep has changed, run

M-x wgrep-save-all-buffers
  • To save buffer automatically when wgrep-finish-edit.
(setq wgrep-auto-save-buffer t)
  • You can change the default key binding to switch to wgrep.
(setq wgrep-enable-key "r")
  • To apply all changes regardless of whether or not buffer is read-only.
(setq wgrep-change-readonly-file t)

Trivial features:

  • wdired.el like interface.
  • Support GNU grep --context (-A -B and -C) option.
  • Can handle too many files.
  • Can handle newline insertion in grep buffer.
  • Delete whole line include newline.

Similar software:

GNU sed helm-ag has a similar feature.

History:

This program was forked from Matsushita Akihisa's grep-edit.el v2.11. As this website is now inaccessible, emacswiki.org's copy may be consulted.

Imported version can be downloaded from this orphan commit: https://github.com/mhayashi1120/Emacs-wgrep/tree/import-original-author/

Following added implementations and differences.

  • Support GNU grep context option -A -B and -C
  • Some bugfix. (wrong coloring text etc..)
  • wdired.el like interface.
  • Remove all advice.
  • Bind to local variables. (grep-a-lot.el works well)
  • After save buffer, colored face will be removed.
  • Change face easy to see.
  • Reinforce checking error.
  • Support removing whole line include new-line.

wgrep's People

Contributors

bling avatar damiencassou avatar dsedivec avatar gvol avatar iquiw avatar magnars avatar mhayashi1120 avatar minad avatar sten0 avatar stig avatar tarsius avatar thierryvolpiatto avatar yuja avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.