How to change the default document viewer in ranger

default settingsdocument-managementranger

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.

Best Answer

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.

Related Question