sh: Ensure environment editor is available

When setting the environment variable EDITOR in the shell, ensure that
the editor being set is actually available: It first tries nvim, then
falls back to micro, then nano (one of which really every distribution
should have).
This commit is contained in:
Marty Oehme 2022-12-20 23:03:35 +01:00
parent 5fce112927
commit 2e6c1026fb
Signed by: Marty
GPG Key ID: 73BA40D5AFAF49C9
1 changed files with 11 additions and 1 deletions

View File

@ -20,7 +20,17 @@ export LIBRARYROOT="${LIBRARYROOT:-$HOME/documents/library}"
export BIBFILE="${BIBFILE:-$LIBRARYROOT/academia/academia.bib}"
# these are my personal 'important' application settings
export EDITOR="nvim"
if exist nvim; then
export EDITOR="nvim"
elif exist vim; then
export EDITOR="vim"
elif exist vi; then
export EDITOR="vi"
elif exist micro; then
export EDITOR="micro"
else
export EDITOR="nano"
fi
export BROWSER="qutebrowser"
export TERMINAL="wezterm"
export PAGER="less"