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