How to change the default document viewer in ranger?

17,341

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.

Share:
17,341

Related videos on Youtube

PatrickSteiner
Author by

PatrickSteiner

Preferred OS: Linux Mint 18.3 Sylvia Occupation: Computer Science Student

Updated on September 18, 2022

Comments

  • PatrickSteiner
    PatrickSteiner almost 2 years

    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.

  • PatrickSteiner
    PatrickSteiner about 6 years
    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!