-
Notifications
You must be signed in to change notification settings - Fork 5
/
fish.sh
executable file
·57 lines (44 loc) · 1.16 KB
/
fish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# shellcheck source=./functions.sh
source ./functions.sh
if ! which fish > /dev/null 2> /dev/null; then
echo "missing fish :("
exit 1
fi
echo "🐟 configuring fish"
fish_path=$(which fish)
if test -f /etc/shells && ! grep -q "$fish_path" /etc/shells; then
sudo bash -c "which fish >> /etc/shells"
fi
if running_macos; then
if ! dscl . -read "$HOME" UserShell | grep -q "$fish_path"; then
chsh -s "$fish_path"
fi
fi
if ! fish -c "type fisher >/dev/null 2>/dev/null"; then
echo "installing fisher"
fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher"
fi
plugins=(
IlanCosman/tide@v5
jethrokuan/z
jorgebucaran/autopair.fish
)
if command_available fzf; then
plugins+=(PatrickF1/fzf.fish)
fi
if command_available direnv; then
plugins+=(halostatue/fish-direnv)
fi
echo "previous plugins:"
if [ -f ~/.config/fish/fish_plugins ]; then
cat < ~/.config/fish/fish_plugins
fi
rm -f ~/.config/fish/fish_plugins
echo
echo "rebuilding list of plugins"
for plugin in "${plugins[@]}"; do
echo "$plugin"
fish -c "fisher install $plugin"
done
echo