0

Since quite some time the file-preview-window in ranger stays empty.
I.e. it indeed shows up but does not preview the content of text-files.
Image preview and .pdf preview however does work.

The content of my ranger-config-file looks like the following:

user@computer ~ $ cat ~/.config/ranger/rc.conf
map DD shell mv %s /home/${USER}/.local/share/Trash/files/
# set colorscheme [default|jungle|snow|solarized]
set colorscheme default
set mouse_enabled false
set preview_images true
set preview_files true

Solution attempt 1:
I even explicitly inserted the line set preview_files true into rc.conf, all tough according to this site, ranger should preview text-file-contents by default.

Solution attempt 2:
According to archlinux the function in order to preview PDFs and images is stored in ~/.config/ranger/scope.sh, so I did some research and figured out by this side, that scope.sh is the script ranger runs when it tries to preview any file. I never changed it knowingly, but to be save i did reset it:

user@computer ~ $ rm ~/.config/ranger/scope.sh 
user@computer ~ $ ranger --copy-config=scope

Still the preview stays empty!

0

Finally I found a solution:
I just edited in ~/.config/ranger/scope.sh the case "$extension" in-statement, by adding a new case called txt and every time when ranger finds a file with this extension it shall concatenate (cat) this file of given $path variable to stdout, therefore the preview window works again as expected:

case "$extension" in
    txt)
        cat "$path"

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.