From 80ecba539640a5ba151737f4b33e4af5eeef964b Mon Sep 17 00:00:00 2001 From: PowerUser64 <blake@blakenorth.net> Date: Wed, 11 Sep 2024 00:00:03 -0700 Subject: [PATCH] shell: add and source plugins Currently only zoxide --- .config/shell/plugins | 15 +++++++++++++++ .config/shell/shrc | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 .config/shell/plugins diff --git a/.config/shell/plugins b/.config/shell/plugins new file mode 100644 index 0000000..11ff103 --- /dev/null +++ b/.config/shell/plugins @@ -0,0 +1,15 @@ +#!/bin/sh +# shell plugins for POSIX + +# Enable zoxide if it exists +if command zoxide > /dev/null 2>&1 || ${SKIP_ZOXIDE:-false}; then + # Check what shell we're using based on variables that get set by non-posix shells - https://stackoverflow.com/a/3327022 + if [ -n "${ZSH_NAME+set}" ]; then # zsh + eval "$(zoxide init zsh)" + elif [ -n "${BASH+set}" ]; then # bash + eval "$(zoxide init bash)" + else + # assume posix + eval "$(zoxide init posix --hook prompt)" + fi +fi diff --git a/.config/shell/shrc b/.config/shell/shrc index d027687..ea751f2 100644 --- a/.config/shell/shrc +++ b/.config/shell/shrc @@ -82,6 +82,10 @@ ${SKIP_FUNCTIONS:-false} || fnupdate ### Options >>> set -o vi +# <<< +### "Plugins" >>> +${SKIP_SH_PLUGINS:-false} || careful_source "$SHELL_CONFIG_DIR/plugins" + # <<< # <<<