diff --git a/functions/c_fisher.fish b/functions/c_fisher.fish index f03918a..5f4c18f 100644 --- a/functions/c_fisher.fish +++ b/functions/c_fisher.fish @@ -6,30 +6,40 @@ # ╰───────────────────────────────────╯ function check_fisher -if test ! -e $HOME/.config/fish/functions/fisher.fish - curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher -else -# ─< define plugins to use with fisher >──────────────────────────────────────────────────── -set plugin "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish" + if test ! -e $HOME/.config/fish/functions/fisher.fish + curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source + fisher install jorgebucaran/fisher + end -# ─< define dependencies for the plugins used by fisher >─────────────────────────────────── -set dependencies "fzf" + # Define plugins to use with fisher + set plugins "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish" -# ─< forloop for the plugin installation/update >─────────────────────────────────────────── - for plug in $plugin - if fisher update $plug - echo "Updated $plug" + # Define dependencies for the plugins used by fisher + set dependencies "fzf" + + # Loop for plugin installation/update + for plugin in $plugins + if fisher list | grep -q (basename $plugin) + fisher update $plugin + echo "Updated $plugin" else - fisher install $plug - echo "Installed $plug" - end - end - for dep in $dependencies - if ! command -v $dep >/dev/null 2>&1 - $FISH_INSTALL $dep + fisher install $plugin + echo "Installed $plugin" end end + # Check and install dependencies + for dep in $dependencies + if not command -v $dep >/dev/null 2>&1 + echo "Dependency $dep is not installed. Installing..." + if test -n "$FISH_INSTALL" + $FISH_INSTALL $dep + else + echo "FISH_INSTALL is not defined. Please install $dep manually." + end + end end -# ──────────────────────────────────────< function end >────────────────────────────────────── end + +check_fisher +