11

At the moment I am constantly changing the rc.conf and rifle.conf files, but every time I want to test the new configuration I need to exit ranger and start again.

Is there a solution for this?

In vim I use :source ~/.vimrc to reload the configuration file, but this doesn't work in ranger.

9

Here is a tricky way to do this, and this may not always work if they change their code (and there could be cases where restarting ranger is better/safer).

rc.conf

In ranger, assuming you have a custom rc.conf in ~/.config/ranger/rc.conf, type:

:eval fm.source(fm.confpath('rc.conf'))

I tested this by changing set draw_borders true/false in ~/.config/ranger/rc.conf.

rifle.conf

In ranger, assuming you have a custom rifle.conf in ~/.config/ranger/rifle.conf, type:

:eval fm.rifle.reload_config()

Note that this was tested with the latest Git commits.

1

https://github.com/ranger/ranger/wiki/Keybindings#quick-editing-rcconf says that you can use this to quickly edit the rc.conf file and source it once saving it:

map xx chain shell vim -p ~/.config/ranger/rc.conf; source ~/.config/ranger/rc.conf

and this works for scope.sh:

map xr chain shell vim -p ~/.config/ranger/scope.sh; source ~/.config/ranger/scope.sh

this is works for rifle.conf

map xr chain shell vim ~/.config/ranger/rifle.conf; eval fm.rifle.reload_config()

I'll update this reply once I know the correct configuration for commands.py. If anyone knows, please edit this.

  • This part of ranger's source code loads commands.py. I wasn't able to call those functions from rifle.conf, though. – Matthias Braun Jan 22 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.