[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: TIL about string-rectangle
From: |
Drew Adams |
Subject: |
RE: TIL about string-rectangle |
Date: |
Wed, 30 Dec 2020 13:43:32 -0800 (PST) |
> Poking around for help from Emacs against a future need, I
> discovered replace-rectangle, which turns out to be an alias for
> string-rectangle (bound to C-x r t). It looks to be quite handy when
> you need to replace text within a rectangle. It's sort of (but not
> quite) like narrow-to-region + query-replace(-regexp)?. It doesn't
> query for a string to replace. It simply replaces the rectangle's
> contents with the given string on each line.
You can also use the usual replacement commands
in a rectangular region. `C-x SPC' to establish
the region, then `C-M-%' or whatever, to search
and replace only with that rectangular region.
___
And if you use library `isearch+.el' then you can
constrain Isearch to within just the region,
including a rectangular region.
https://www.emacswiki.org/emacs/IsearchPlus#isearchp-restrict-to-region-flag
https://www.emacswiki.org/emacs/download/isearch%2b.el