Live data from Hacker News

A terminal file manager written in bash

github.com

21–30 of 44 posts

Re: A terminal file manager written in bash

#22
given that this is only 100 lines of code i am quite impressed.

however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename.

i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

Re: A terminal file manager written in bash

#23
post #22

given that this is only 100 lines of code i am quite impressed. however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename. i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

Put the filename into a shell variable, then sed or split it into characters and then concat.

Re: A terminal file manager written in bash

#24
post #22

given that this is only 100 lines of code i am quite impressed. however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename. i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

looks like ranger does it. i'll have a closer look at that

Re: A terminal file manager written in bash

#25

Does this do anything I can't do already via Emacs?

Two things that I always reach for Emacs to accomplish are git and file management, via Magit and Dired(X) respectively. Here's a quick cheat sheet of the things I use Dired for: C-x C-j (jump to directory) Open the current directory in Dired (requires that you first (require 'dired-x)) from any buffer, even other directories, but usually from within files. C-x C-q (edit directory) Start editing the current directory…

Wow, I switched to Emacs earlier this year and have not encountered dired mode before. This is fantasic!

Re: A terminal file manager written in bash

#26
post #22

given that this is only 100 lines of code i am quite impressed. however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename. i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

No need for a filemanager for in place file renaming. For that I'd just use curly bracket in bash or zsh.

e.g.

  mv /path/to/file{-old-name,-new-name}.txt
which expands to:

  mv /path/to/file-old-name.txt /path/to/file-new-name.txt

So use tab completion to get your path then go back and stick your curly brackets into it as needed. Oh and it works for things like git branch renaming or anything else you do in the terminal.

Re: A terminal file manager written in bash

#27
post #22

given that this is only 100 lines of code i am quite impressed. however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename. i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

If I'm understanding you correctly, then imv[1] is a great tool for this. 'imv $filename' pops you in to a readline enabled prompt to edit $filename. Given that it is readline you can even add extra options in your ~/.inputrc to add additional features to it, I have mappings for custom dir prefixes as an example.

It also comes with qmv, which will pop open an editor for you to perform inplace edits on filenames. Which is kinda like dired as an emacs comparison, at least if you squint an awful lot.

1. http://www.nongnu.org/renameutils/

Re: A terminal file manager written in bash

#28
post #26
post #22

given that this is only 100 lines of code i am quite impressed. however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename. i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

No need for a filemanager for in place file renaming. For that I'd just use curly bracket in bash or zsh. e.g. mv /path/to/file{-old-name,-new-name}.txt which expands to: mv /path/to/file-old-name.txt /path/to/file-new-name.txt So use tab completion to get your path then go back and stick your curly brackets into it as needed. Oh and it works for things like git branch renaming or anything else you do in the terminal…

If you're a zsh user you can also use the other zshparam(1) stuff too. Like "mv file.ext{,(:r)}" to perform "mv file.ext file", or :l to lowercase a filename, or any number of other sometimes useful or often pointless things ;) I've used :l a number of times, but :s for substition is probably the most useful in general.

Re: A terminal file manager written in bash

#30
post #27
post #22

given that this is only 100 lines of code i am quite impressed. however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename. i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

If I'm understanding you correctly, then imv[1] is a great tool for this. 'imv $filename' pops you in to a readline enabled prompt to edit $filename. Given that it is readline you can even add extra options in your ~/.inputrc to add additional features to it, I have mappings for custom dir prefixes as an example. It also comes with qmv, which will pop open an editor for you to perform inplace edits on filenames. Whic…

those are exactly like what i had in mind. thanks!

qmv even handles swapping filenames which ranger doesn't.

greetings, eMBee.

Post reply on HN