From edf46ba158d8a98fe1baac2cdeb337046be38ce2 Mon Sep 17 00:00:00 2001 From: Trysdyn Black Date: Mon, 8 Jan 2024 06:12:06 -0800 Subject: [PATCH] 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. --- .profile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.profile b/.profile index e6eaeb2..6c147a9 100644 --- a/.profile +++ b/.profile @@ -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