6 ms·
Nice collection of quite useful tools. Some of these can be easily replicated by using a more modern shell (bash, zsh) like mispipe, others are just shortcuts (
by jfreax 6y ago
Nice collection of quite useful tools. Some of these can be easily replicated by using a more modern shell (bash, zsh) like mispipe, others are just shortcuts (e.g. ifne, chronic).
But what immediately stood out to me is `vidir`. I really like the idea of editing file names with an editor. Using loops and regex in a shell for mass renaming can be a mess. It should be way easier with `vim`.
This tool made me install moreutils.
- pmoriarty 6y agoCheck out renameutils[1], which has the advantage over vidir of doing sanity checks before renaming. Also, this can be done in emacs using wdired. [1] - http://www.nongnu.org/renameutils/ http://www.nongnu.org/renameutils/
- brobdingnagians 6y agoThe ranger file manager also has this built in.
- RMPR 6y agoWas about to point this out, but it's good to know if you ssh in a box which doesn't have Python installed. Edit: Or use a more portable terminal FM, nnn pops to my mind
- nieve 6y agoMMV is reasonably powerful, but straightforward, can produce & consume rename listings, and is included in a lot of distros.: https://git.deb.at/w/pkg/mmv.git https://git.deb.at/w/pkg/mmv.git
- markrages 6y agoSee writable dired-mode in emacs. Here's a short demo: https://youtu.be/8l4YVttibiI https://youtu.be/8l4YVttibiI
- ainar-g 6y agoOn most POSIX systems you can use fc(1) to edit a command in your $EDITOR. In vi(1) and friends you can then use "%!ls" to replace the contents of the buffer with directory listing and edit the commands you want. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fc.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/f... https://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/v...
- RMPR 6y ago> you can then use "%!ls" to replace the contents of the buffer with directory listing and edit the commands you want. I often used :r !ls for that, thanks for the tip + it's shorter
- gpanders 6y agoNote that in general this is not a one-to-one replacement. `%!cmd` sends the current buffer contents to `cmd`’s stdin and replaces the buffer with `cmd`’s output. In the case of ‘ls’ this works since it doesn’t take anything on stdin
- Legogris 6y agoYou just improved my life. Thank you.
- throwanem 6y agoIn Emacs, you can do this by invoking shell-command-on-region, by default bound to C-u M-| - iirc if no region is active it replaces the buffer, but I rarely use it that way so I might be wrong about that. At worst, C-x h C-u M-| gets you there.
- skywal_l 6y agohuh! I've been working on posix systems for 20 years and I didn't know that...
- alpaca128 6y agoIt's one of the reasons I like using the nnn file manager. It has a batch rename feature with exactly that functionality.
- jsilence 6y ago+1 for the powerful yet minimalistic nnn where concise help is only a question mark away and the default mnemonics make sense. Wonderful piece of software.
- gpanders 6y agoHonestly one of the most well maintained projects I’ve ever used. The author has a coherent “philosophy” and vision of how the program should work and does a good job of preventing feature/scope creep. Don’t see that too often
- chriswarbo 6y agoI use Emacs shell-mode for most of my terminals, which allows navigating and editing the buffer just like any other file. I'll often make several copies of a command, then use a macro to alter each one; after checking that they look right, pressing Enter will send them all to the shell.
- RMPR 6y agoI always tried to use the shell with emacs (eshell, multi-term) but it didn't render correctly curses and all the fancy stuffs like emojis. Out of curiosity, how do you manage that?
- throwanem 6y agoUsually with ansi-term instead, if I'm honest. Also look into emojify-mode if your system doesn't handle emoji fonts well or at all.
- throwanem 6y agoBelatedly to add - look into the eshell-visual-* lists, to configure commands, subcommands (like "git log"), and I think some other traits, such that matching commands get their own ansi-term buffer.
- zshev 6y agoCheck out emacs-libvterm. I’ve replaced all terminal emulators with it. All the benefits of an Emacs buffer and no issues with curses or lag.
- chriswarbo 6y agoI use a separate terminal (st) for curses-like things. They work in Emacs ansi-term, but since that doesn't offer the same navigation/editing interface as normal Emacs buffers I don't find it compelling enough to use. Eshell is interesting, but I can't use the bashisms I'm used to, and I can't copy commands back-and-forth between the prompt and a standalone script. shell-mode lives in-between these two extremes: it runs a normal shell, but Emacs manages the buffer. I don't know about ansi-term or eshell (or alternatives mentioned by others), but shell-mode handles emoji fine, as well as progress bars and colour codes; I think it defaults to TERM=dumb, so many programs won't output colour, etc. unless you override it to something like TERM=xterm-256.
- nickjj 6y agoThere are Vim plugins that let you rename files and directories within Vim, such as https://github.com/qpkorr/vim-renamer https://github.com/qpkorr/vim-renamer. Also if you happen to use fern[0] you can mark off multiple files and directories, hit a hotkey and now you can edit their paths in a Vim buffer. [0]: https://github.com/lambdalisue/fern.vim https://github.com/lambdalisue/fern.vim
- krick 6y ago> vidir I just use ranger for that.
- tambourine_man 6y agoYou should check out: https://github.com/justinmk/vim-dirvish https://github.com/justinmk/vim-dirvish
- chronolitus 6y agoyou might also be interested in vimv and vimcp https://github.com/thameera/vimv https://github.com/thameera/vimv https://github.com/danieldugas/vimcp https://github.com/danieldugas/vimcp
- globular-toast 6y agoEmacs has dired for that reason. Imagine ls that you can edit.
- msoucy 6y agoI used vidir yesterday for something that would have been more annoying with other tools - if you swap the numbers at the beginning of the line, then you'll safely swap the file contents. Useful if your TV episodes are named the wrong thing...
- jabirali 6y agoI've known about `moreutils` for years, but the only two I ended up actively using myself are `vidir` and `vipe`. Outside of `moreutils`, one of the utilities I always install on all my machines is `atool`, which is just so much nicer and more intuitive than trying to remember the command-line options needed to handle the various tar.*, rar, zip, 7zip, lzip, etc. archive formats from the command line.