How to set default text editor in ranger? My shell is fish

Viewed 97

When I'm trying open some text document using ranger and having this error:

/bin/sh: line 1: vim: command not found

I have this strokes in config.fish:

set EDITOR "nvim"
set VISUAL "nvim"

I'm using fish as my shell. How can I set up default editor in ranger without changing rifle.conf?

1 Answers

Without any options the set command only sets variable locally and doesn't export it.

For global variables that should be exported (like the EDITOR variable should be) then use the -g and -x options:

set -gx EDITOR "nvim"
set -gx VISUAL "nvim"

The most important option is the -x option. From the previously linked reference:

Causes the specified shell variable to be exported to child processes (making it an “environment variable”)

[Emphasis mine]

Related