fish/functions/c_fisher.fish
2024-05-25 13:58:40 +02:00

45 lines
1.5 KiB
Fish

# ╭───────────────────────────────────╮
# │ This file holds the content to │
# │ install and configure the plugins │
# │ used by fisher, and of course the │
# │ fisher itself │
# ╰───────────────────────────────────╯
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
end
# Define plugins to use with fisher
set plugins "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish"
# 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 $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 ' $FISH_INSTALL '. Please install $dep manually."
end
end
end
end
check_fisher