Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Any time renaming gets more complicated than (a) bash curly braces or (b) rename command (Perl script that applies sed expression to each file name), I break out Emacs wdired.

Then you can use all the Emacs tools to perform a mass edit across multiple file names, and get them right before committing to the rename. Multiple cursors makes a great addition, as does iedit-mode.



This. When I figured out you could edit the directory listing like a file and then have Emacs apply those edits I felt like I had acquired superpowers.

Actually I generally feel like I have superpowers when I use Emacs. The feeling was stronger than usual that day.


vidir + vi/ed does the same. It puts the directory as a text buffer, with an entry per line.


Multiple cursors plus C-x C-q on a dired buffer is amazingly powerful: you literally just make changes to the lines in the buffer and run C-c C-c to commit them, or C-c C-k to cancel. I've used this for very powerful mass-renames before. (I imagine it also works for deleting files by removing that line but never needed to try it before.)


I use Emacs inside iTerm2. (i.e. `emacs -nw`) Do you know if the multiple cursors package (which I just found today thanks to your comment) works with that? Or is it only in the native windowed version?


It works with terminal-based emacs too. It just inverses the background color of cells to fake the extra cursors.


That is a glorious hack. Thanks! I'll try it out for a spin!




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: