January 25, 2020

Ranger config

For navigating large folders I currently use Ranger: "A VIM-inspired file manager for the console". Ranger uses it's own file opener Rifle. This post show how to by pass this and use xdg-open.

/images/ranger.png

Configuration

If you haven't used Ranger before the first step is to copy the default configuration by running the command

$ ranger --copy-config=all

This will copy the default files to your ~/.config/ranger/.

├── commands_full.py
├── commands.py
├── rc.conf
├── rifle.conf
└── scope.sh

I'm only interested of changing the commands that ranger invokes when I'm opening files. That's done by editing rifle.conf To only copy rifle.conf the invocations is:

$ ranger --copy-config=rifle

Since I already use a work flow involving xdg-open this is my command of choice. As i only have one rule, use xdg-open my rifle.conf becomes a simple:

file, else = xdg-open "$@"