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

Time:08-09

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?

CodePudding user response:

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