Use nvim if installed

This commit is contained in:
Anthony Rose 2024-02-29 11:13:35 +00:00
parent 54ec2aca1a
commit 687cd542cc

View file

@ -38,7 +38,6 @@ export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
export DOTNET_ROOT="$HOME/.dotnet" # https://aka.ms/dotnet/download
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export EDITOR=vi
export ENV="$HOME/.shrc"
export GOTELEMETRY=off
export HISTCONTROL=ignorespace:ignoredups
@ -212,15 +211,27 @@ then
export GPG_TTY
fi
# Set up Vi/Vim.
if command -v vim > /dev/null
# Set up vi/nvi/vim/nvim.
unalias nvim 2> /dev/null
unalias vim 2> /dev/null
unalias nvi 2> /dev/null
unalias vi 2> /dev/null
if command -v nvim > /dev/null
then
export EDITOR="vim -f"
EDITOR="nvim -f"
alias vi=nvim
elif command -v vim > /dev/null
then
EDITOR="vim -f"
alias vi=vim
elif command -v nvi > /dev/null
then
EDITOR="nvi"
alias vi=nvi
else
export EDITOR=vi
alias vim=vi
EDITOR=vi
fi
export EDITOR
# Use root's cache instead of having one for root and one for the user.
if [ "$(id -u)" -ne 0 ] && [ -x /usr/bin/dnf ]