Set EDITOR in .profile for helix->vim

Having to find helix is annoying... and in any case default to vim
if it doesn't exist. If we end up on a box with no vim at all,
we'd be calling an editor by path anyway.
This commit is contained in:
Trysdyn Black 2024-01-08 06:12:06 -08:00
parent 8aeab7241d
commit edf46ba158

View file

@ -5,9 +5,24 @@ if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
eval `keychain --eval id_ed25519`
fi
# These are pretty safe to assume exist
# Put ~/bin first in my path so I can customize commands
# This isn't great on a security level and I should stop this.
export PATH=~/bin:$PATH
export EDITOR=vim
# Figure out my editor. I want helix if this box has it, but where it is
# is inconsistent thanks to Archlinux packaging. It can be /usr/bin/helix,
# or /usr/bin/hx. My puppet code creates /bin/hx to normalize this too.
# If we don't have helix, just shotgun using vim and pray.
if [ -e /bin/hx ]; then
export EDITOR=/bin/hx
elif [ -e /usr/bin/helix ]; then
export EDITOR=/usr/bin/helix
elif [ -e /usr/bin/hx ]; then
export EDITOR=/usr/bin/hx
else
export EDITOR=vim
fi
export VISUAL=$EDITOR
# Figure out my pager; these don't necessarily exist