diff --git a/.config/shell/env b/.config/shell/env index 0441a02..db7cf6f 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -55,13 +55,20 @@ if [ -z "$PROFILE_LOADED" ] && [ -f ~/.profile ]; then fi # Intelligently set $EDITOR -if [ "${EDITOR:-}" = "" ] || [ "${EDITOR##*/}" = "nano" ]; then +if [ "${EDITOR:-}" = "" ] || + [ "${EDITOR##*/}" = "nano" ] || + ! command -v "$EDITOR" > /dev/null +then if command -v nvim > /dev/null;then export EDITOR=nvim elif command -v vim > /dev/null;then export EDITOR=vim elif command -v vi > /dev/null;then export EDITOR=vi + elif command -v nano > /dev/null; then + export EDITOR=nano + else + echo "Error: couldn't find a valid candidate for \$EDITOR" >&2 fi fi export SYSTEMD_EDITOR="$EDITOR" @@ -75,6 +82,9 @@ if test -n "${ZSH_VERSION:-}"; then export NIX_BUILD_SHELL=zsh fi +# Launch zsh if we haven't yet +LAUNCH_ZSH="${LAUNCH_ZSH:-true}" + # Basic default LS colors export LSCOLORS="Gxfxcxdxbxegedabagacad" diff --git a/.config/shell/plugins b/.config/shell/plugins index da0fd55..ee9d0df 100644 --- a/.config/shell/plugins +++ b/.config/shell/plugins @@ -13,3 +13,11 @@ if command -v zoxide > /dev/null 2>&1 || ${SKIP_ZOXIDE:-false}; then eval "$(zoxide init posix --hook prompt)" fi fi + +# Switch to zsh if we're told to +if [ "${LAUNCH_ZSH:-false}" = true ] && command -v zsh > /dev/null 2>&1; then + LAUNCH_ZSH=false exec zsh +fi + +# terminal colorscheme +careful_source "$SHELL_CONFIG_DIR/colors.sh" diff --git a/.config/shell/shrc b/.config/shell/shrc index ea751f2..fe57dc1 100644 --- a/.config/shell/shrc +++ b/.config/shell/shrc @@ -82,10 +82,6 @@ ${SKIP_FUNCTIONS:-false} || fnupdate ### Options >>> set -o vi -# <<< -### "Plugins" >>> -${SKIP_SH_PLUGINS:-false} || careful_source "$SHELL_CONFIG_DIR/plugins" - # <<< # <<< @@ -98,7 +94,9 @@ ${SKIP_UPDATES:-false} || careful_source "$SHELL_CONFIG_DIR/updates" \ "Error: failed to run update script" $LINENO -x "command" ### <<< -# terminal colorscheme -careful_source "$SHELL_CONFIG_DIR/colors.sh" +### "Plugins" >>> +${SKIP_SH_PLUGINS:-false} || careful_source "$SHELL_CONFIG_DIR/plugins" + +# <<< # vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3:ts=3 diff --git a/.zshrc b/.zshrc index 1ecff9f..21561c6 100644 --- a/.zshrc +++ b/.zshrc @@ -265,6 +265,8 @@ load_working_dir && cd - > /dev/null || true # <<< # <<< +export BASH_LAUNCH_ZSH=false + # Optionally source another zshrc ${SKIP_LOCAL_ZSHRC:-false} || careful_source "$SHELL_CONFIG_DIR/local/zshrc"