
Ranger: A console file manager with VI key bindings - crowf
https://github.com/ranger/ranger
======
KKPMW
I use the command line extensively but never found a need for a file manager
in there. Just `cp`, `mv`, `rm`. Am I missing something big by not having one?

~~~
BeetleB
One answer you probably won't be happy with: You don't need to memorize lots
and lots of command line options. I can never remember the ones for tar, for
example.

Bookmarking directories (local and remote), although there are command line
ways to do this.

Being able to quickly view the contents of multiple files (that don't have a
simple pattern in the filename). Frankly, any operation you want to do on
multiple files that don't have a convenient regex to specify on one command.
Say you have a directory of 100 files, and you want to copy about 15 of them
elsewhere. It's just a lot easier in midnight commander to select them than to
type out all their names.

And then there's stuff like selecting all files that have certain permissions,
etc. No doubt you can do this from the command line, but again: Convenient
when you don't know how.

Bulk renaming of files - again: I don't remember how to do this on the command
line, and it's dangerous if I screwup.

Easily navigate any compressed files and copy stuff into/out of it.

~~~
jnxx
> You don't need to memorize lots and lots of command line options.

But instead, the keyboard shortcuts for the file manager.

> Bookmarking directories (local and remote), although there are command line
> ways to do this.

For example zoxide. And depending on the usage pattern, it might turn out more
flexible and easier to interconnect with other things.

> Say you have a directory of 100 files, and you want to copy about 15 of them
> elsewhere.

What is your typical use case for doing this?

I can quickly think of two situations where I needed to do that:

One I was copying a selection of photos for my uncle to a folder which I was
going to burn on a CD. I am right now not sure whether his laptop still has a
CD drive.

The other was I was developing some windows library and I needed to make a zip
package for other people to test it, because there was still no installer.

I think I am not that unusual that generally I try to avoid making copies of
the same data to different places; I try to use version control instead.

~~~
BeetleB
I was going to respond individually, but I realized we're looking at this the
wrong way.

If you compare bash of today with that of 20 years ago, a lot of
extensions/features have been added. On top of that, people use 3rd party
tools to enhance their command line experience - you yourself mentioned
zoxide. Lots of people make use of fzf. Imagine someone asking what the
benefit of fzf is over using the command line - you likely will say that
there's a false dichotomy - fzf is a command line tool to enhance your
experience.

Likewise, midnight commander really is just that. You don't have to choose
between the two. When running mc, you have full access to the command line. If
you wish, you can just make the panels disappear and invoke them with a
keybinding whenever you want to use them. I assume ranger will have similar
capability.

It's not mc or the command line. It's mc _and_ the command line.

~~~
jnxx
> It's mc and the command line.

But does using both not mean one has to memorize more?

~~~
BeetleB
Of course: In the same way as using fzf or zoxide means memorizing more. In
the same way that using a modern shell means memorizing more. At my work there
are a lot of people who don't know you can search your bash history with
Ctrl-R because they learned the shell before that was a feature (or in most
cases, before it was enabled by default).

My point is that the separation between mc and the command line is an
_artificial_ one. If you don't want to learn, you can always stick to an
ancient shell and not learn all the new features. If you are willing to learn,
then don't make a distinction between mc and shell features. It's basically:
Here are N new useful things to learn, and perhaps I'll want to learn some of
them. It's not: Here are N shell features to learn, and M other tools to
learn.

Of course, you always have to ask yourself if learning it is a good use of
your time. I myself have not learned any new shell featuresin a decade - I
don't know what the new features are (I have, though, learned new _shells_ ).
At some point, I realized there are too many things to learn and I need to
strategize. I tried learning ranger a year or two ago. I definitely saw its
power, but of all the things I wanted to learn, it was low on my list, so I
dropped it. OTOH, I did learn dired recently, as I've always been a heavy
Emacs user and I had neglected learning it all this time. mc is still better,
though, but dired does have some capabilities that mc doesn't have. I started
using autojump this year - now you tell me about zoxide. Maybe one day I'll
look into it, but not today.

------
rjzzleep
I'm kinda liking nnn it feels more intuitive than ranger. Although I find the
documentation on configuration lacking.

[https://github.com/jarun/nnn](https://github.com/jarun/nnn)

~~~
apjana
It's here -
[https://github.com/jarun/nnn/wiki/Usage#configuration](https://github.com/jarun/nnn/wiki/Usage#configuration)

If that's not enough, can you be more specific?

------
tandav
just a reminder: vim has it's own file browser netrw:

    
    
        vim .
    

It has many known bugs but I use it because it don't need any extra
install/config patching. Just simple file browser to find a file to open in
vim.

~~~
MayeulC
Someone knows if you can replace that vim interface with ranger itself, BTW?
That could be quite handy in a pinch (having a split dedicated to ranger, for
instance).

~~~
I_complete_me
[https://github.com/francoiscabrol/ranger.vim](https://github.com/francoiscabrol/ranger.vim)

------
Comkid
As an extensive ranger user, some of the features which lead to me not even
running a graphical file manager:

> Using ranger to change directories (see:
> [https://github.com/ranger/ranger/wiki/Integration-with-
> other...](https://github.com/ranger/ranger/wiki/Integration-with-other-
> programs#changing-directories))

> Launch ranger using a keybinding from my shell (`bind` or `~/.inputrc` for
> bash, `bindkey` for zsh), which when combined with the previous technique
> allows me to very quickly switch folders (also combined with bookmarks) and
> get my bearings

> `:filter` to filter the items in the current folder (supports regex and has
> a live preview which updates as you type, can get laggy in large folders)

> `:flat` to flatten directory structures (-1 for infinite depth)

> `m<key>` to bookmark something, which you can jump to with `'<key>`
> (apostrophe)

> `om` to sort by last modification time, `os` to sort by size

> `dc` to recursively find the size of a directory (can be slow)

> `C-n` to create new tabs and `gt`/`gT` to switch back and forth between tabs
> which can be useful for copying/moving files

~~~
MayeulC
I also use `:bulkrename` a lot. It just opens a list of filenames in vim for
modification, which makes it extremely simple to use regexes, macros, visual
block modifications to rename a batch of files to your liking.

As well as `~` to switch from tabs to split-panes.

I'm just missing jumping to a file/folder by typing a few letters, as I have
yet to get started with plugins like someone suggested me (
[https://news.ycombinator.com/item?id=23507694](https://news.ycombinator.com/item?id=23507694)
).

Edit: someone wrote about `f` below, that looks like a very good answer.

Ah, and a little too eager to produce image previews for huge svg or png files
(~20M), while leaving the background process when I change files. That can
suck up huge amounts of RAM.

------
mekster
There's also vifm but somehow I don't get to use console file managers but
just manage files the traditional methods of cd, ls etc.

[https://vifm.info/](https://vifm.info/)

~~~
DavideNL
I find Ranger a lot easier, in Vifm I always have the feeling that 1 wrong
keepress can have massive consequences without having any idea what
happened/how to undo it.

Perhaps that's just me not knowing vifm well enough...

------
eterps
It just occurs to me that 'managing files' is not something I tend to do
anymore. My files generally stay in the place they are. And when I do manage
files it usually involves a VCS anyway.

I do think file managers might be very useful for previewing files.

------
wincent
Another Ranger-like that is worth a look is "lf", written in Go, and in my
experience faster:
[https://github.com/gokcehan/lf](https://github.com/gokcehan/lf)

~~~
adem
It's a good option if you're on a Windows machine.

------
bvrmn
Unfortunately after 1.9.1 ranger has changed color handling and ignores
terminal colors and tries to use its own scheme. It there any recipe to make
ranger use terminal pallet?

------
branon
GNU Midnight Commander user, checking in ;)

