Switch Back to Vim Globally: Fedora 33?

,

Do you know how to replace Nano with nVim as the default editor? I am using the Fish shell and per their tutorial:

A universal variable is a variable whose value is shared across all instances of fish , now and in the future – even after a reboot. You can make a variable universal with set -U

Typing this, however, leads to problems.

~> set -U EDITOR /usr/bin/nvim 
set: Universal variable 'EDITOR' is shadowed by the global variable of the same name.

I thought about just uninstalling Nano, but I don’t know if that’s the best solution. Thanks!

3 Likes

If you are going to use nVim, I don’t see anything wrong with just uninstalling Nano.

2 Likes

There’s a vim-default-editor package that includes the necessary settings:

$ rpmls vim-default-editor
drwxr-xr-x  /etc/profile.d
-rw-r--r--  /etc/profile.d/vim-default-editor.csh
-rw-r--r--  /etc/profile.d/vim-default-editor.sh
drwxr-xr-x  /usr/share/fish/vendor_conf.d
-rw-r--r--  /usr/share/fish/vendor_conf.d/vim-default-editor.fish

To use it, try:

sudo dnf install vim-default-editor --allowerasing
7 Likes

Do you know if this is compatible with Neovim (nvim)? Thanks for the suggestion, by the way.

1 Like

What do you mean by compatible? nvim is a different binary than vim, so the vim default settings won’t work for it. The files just set up system defaults:

# Ensure vim is set as EDITOR if it isn't already set
# This is set as a universal variable so that any other definition
# by the user would win
# Cf. https://fishshell.com/docs/current/index.html#variables-scope

if ! set -q EDITOR;
    set -x EDITOR /usr/bin/vim
end

So, if you want to use nvim, set it for your user profile. That’ll be the simplest thing to do.

2 Likes

Excellent. Thanks, Francisco.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.