Emacs kaizen: helm-swoop and editing
Posted: - Modified: | emacsContinuing on this quest to focus on one tiny little workflow change at a time, so that I can get even better at using Emacs…
One of those packages I installed but never got around to trying out was all
, which lets you interactively edit all lines matching a given regular expression. It’s like an editable occur, sorta.
It turns out that helm-swoop
lets you use C-c C-e
to edit matching lines interactively (so you can use keyboard macros or replace-regexp or whatever). You can type C-x C-s
to save it back to the buffer.
On a related note, I’m still tickled pink every time I use dired-toggle-read-only
(C-x C-q
) to make a Dired buffer editable so that I can batch-rename filenames.
11 comments
Grant Rettke
2015-01-27T00:30:32ZHave you tried using `multiple-cursors' and if so how does it compare to `all'?
TobyHaynes
2015-01-27T18:32:00ZThe nice thing about 'all' is that it brings all the lines you are interested in editing into a smaller buffer than the original. In many cases, this will now fit entirely in the frame. I've occasionally run into trouble with mc/mark-all-like-this where I started editing something I didn't intend to and couldn't see at the current frame position.
Matthew M. Keeler
2015-01-28T00:49:55ZWhen you have multiple active cursors, if you hit C-' it will hide lines that don't have an active cursor.
sachac
2015-01-28T18:17:52ZOh! I didn't know that. Neat. =)
Grant Rettke
2015-01-28T18:33:54ZNice!
milkypostman
2015-01-28T19:15:57Zwow, amazing!
sachac
2015-01-28T18:22:26ZI like helm-swoop for that too; the overview is helpful. Also, having an editable buffer means I can make slightly-different tweaks to each line. I use multiple-cursors if the changes that I want to make are identical across lines. =)
Grant Rettke
2015-01-28T18:33:45ZNice to know, thanks.
milkypostman
2015-01-28T19:16:50ZCan you use `multiple-cursors` inside the swoop buffer?
sachac
2015-01-30T22:55:23ZYup, sure can!
codemac
2015-01-31T04:38:46ZYou can just press the `e' key in occur mode? or does this do something different?