9

How do I change the default document viewer in the file-manager "ranger"?

By pressing [R] it is only possible to choose how to open the document for this one time, but the choice will not be safed. E.g. my default viewer for plain text files is "nano", but i want it to be "vim" as default.

1 Answer 1

11

For text files rifle (ranger's file opener) uses your default $EDITOR. You can set it to vim by adding the line export EDITOR=vim to your ~/.bashrc or equivalent.

For other file types you can configure rifle with the file ~/.config/ranger/rifle.conf. First copy the defaults with ranger --copy-config=rifle. Then rearrange the programs (or add more) in the appropriate section so that your preferred application is at the top.

1
  • In ~/.config/ranger/rifle.conf i added ext c|cpp|txt|md = vim "$@" in the first line and ext c|cpp|txt|md = atom "$@" in the second line, to use atom as my alternative editor. So it worked, thanks! Commented Apr 22, 2018 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .