From 687cd542ccc3dc606a75176ab389a5db832e2f4d Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Thu, 29 Feb 2024 11:13:35 +0000 Subject: [PATCH] Use nvim if installed --- roles/home-cli/files/profile | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/roles/home-cli/files/profile b/roles/home-cli/files/profile index 1ed2e17..c3921ca 100644 --- a/roles/home-cli/files/profile +++ b/roles/home-cli/files/profile @@ -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 ]