3 ms·
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 ou
by barrkel 7y ago
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.
- ashton314 7y agoThis. 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.
- sdegutis 7y agoMultiple 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.)
- ashton314 7y agoI 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?
- anthk 7y agovidir + vi/ed does the same. It puts the directory as a text buffer, with an entry per line.