61 points · by laurent123456 · 12y ago · 42 comments
For the other commenters in this thread that don't see the appeal or keep comparing it to other alternatives, here's what's so compelling to me:
- Editor agnostic. This isn't just for vim, people. ST2 is awesome for this kind of thing.
- Undo. Easy undo. That's a killer feature, and I wouldn't be surprised if it's unique to this tool.
Effusive praise aside, I ran into a couple small issues on OS X:
$ massren --config editor 'subl'
massren: Config has been changed: "editor" = "subl"
$ massren
massren: exec: "subl": executable file not found in $PATH
subl is indeed in my $PATH, but it's actually just a symlink to the ST2 application directory, as the ST2 docs suggest [2]. I solved this by just adding the app directory to my $PATH, but it'd be nice to keep it out of there if possible.Also, I'd like to be able to pass switches along with my editor command, like git config's core.editor [3]. However, this doesn't seem to work:
massren: exec: "subl -wn": executable file not found in $PATH
Anyway, great work once again, and thanks for releasing such a cool tool![1] http://manytricks.com/namemangler/
[2] http://www.sublimetext.com/docs/2/osx_command_line.html
[3] https://help.github.com/articles/using-sublime-text-2-as-you...
At the moment, the tool indeed doesn't support parameters for the text editor, though it's quite trivial to implement. I'm going to add this soon.
M-x wdired-change-to-wdired-mode
(not to spoil the fun of creating a useful command-line tool with Issue9 ;)
- To move files to another directory (by typing their path, absolute or relative, as a part of the new filename).
- To change the target of symbolic links.
- To change the permission bits of the filenames (in systems with a working unix-alike `dired-chmod-program'). [...]
- To mark files for deletion, by deleting their whole filename.
Moretutils also includes 'vipe' (edit pipe in text editor) and other useful utilities.
vidir will probably serve me better.
[1] A utility that is distributed with perl (on Debian as /usr/bin/prename, with a listing in /etc/alternatives for "rename")
Since "wget https://raw.github.com/laurent22/massren/master/install/inst... comes out with certification error, because wget doesn't know github's certification, you need to either add an ignore-cert option or you might wanna change that option to 'curl -O https://raw.github.com/laurent22/massren/master/install/inst... which will not came out with an error. Also, curl is installed by default on MacOSX while wget is not :-)
Cheers!
Currently, the command is not really scriptable, but I'd be open to any suggestion.
I suppose scripting would be hard to do without knowing the editor. I artificially applied vim as the editor because that was what you used in the example. I very recently found vimcat[2] from another thread and thought that something similar could be done with this. I guess it may not be much more effective than just using sed and a for loop in <insert shell here> though.
[1] http://linux.die.net/man/3/pcrepattern [2] http://www.vim.org/scripts/script.php?script_id=4325
Admittedly if there's no binary available for your platform then you need to build from source.
[0] http://brew.sh/
Why don't more commands have this?
My solution was a bit hackier, a bash script that did spit out a bunch of lines for each file in a directory, each with "(mv|cp) 'foo.bar' ''", ready for me to edit and then paste back into a terminal window.
This wasn't clear from the README, but this will work with files across directories (which is both useful and confusing)
massren /*foo.rb
Will rename matching files in different directories, but there is no indication of what directories those are in the editor.
<snark>Also, how could you build something so useful without generics!?</snark>
https://github.com/everett1992/utils/blob/master/sed-utils/m...
Perhaps the ability to define any editor ?