From 38bab29776950ac2364ed64195b89887717c33de Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Thu, 1 Jan 1970 03:00:00 +0300 Subject: chore: init --- profile/.profile.d/50_editor.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 profile/.profile.d/50_editor.sh (limited to 'profile/.profile.d/50_editor.sh') diff --git a/profile/.profile.d/50_editor.sh b/profile/.profile.d/50_editor.sh new file mode 100644 index 0000000..b3203fb --- /dev/null +++ b/profile/.profile.d/50_editor.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +_editors=" +nvim +vim +vi +emacs +nano +ed +" + +for _editor in ${_editors}; do + # shellcheck disable=SC2139 + if command -v "${_editor}" >/dev/null 2>&1; then + export EDITOR="${_editor}" VISUAL="${_editor}" + + alias e="${EDITOR}" + if ! command -v ed >/dev/null 2>&1; then + alias ed="${EDITOR}" + fi + + break + fi +done + +unset _editor _editors -- cgit 1.4.1