13

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.

BenC
  • 1,081
  • 8
  • 11
milarepa
  • 1,456
  • 2
  • 16
  • 22

2 Answers2

12

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.

BenC
  • 1,081
  • 8
  • 11
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.

CodyChan
  • 904
  • 1
  • 10
  • 14
  • [This part](https://github.com/ranger/ranger/blob/fb1ba4a111f818cf2a7d6e9c2f6be230f60bcf69/ranger/core/main.py#L396) of ranger's source code loads `commands.py`. I wasn't able to call those functions from `rifle.conf`, though. – Matthias Braun Jan 22 '19 at 15:59