-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-zsh.sh
More file actions
executable file
·66 lines (54 loc) · 1.52 KB
/
update-zsh.sh
File metadata and controls
executable file
·66 lines (54 loc) · 1.52 KB
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
58
59
60
61
62
63
64
65
66
#!/usr/bin/env zsh
# Helper function to run command if it exists
run_if_command_exists() {
local cmd=$1
local description=$2
shift 2
if command -v "$cmd" &>/dev/null; then
echo "Updating $description..."
"$@"
else
echo "$description not found, skipping..."
fi
}
# Helper function to run commands in a directory if it exists
run_in_dir_if_exists() {
local dir=$1
local description=$2
shift 2
if [ -d "$dir" ]; then
echo "Updating $description..."
(cd "$dir" && "$@")
else
echo "$description directory not found, skipping..."
fi
}
# Helper function to update git repos
update_git_repo() {
local dir=$1
local description=$2
if [ -d "$dir" ]; then
(cd "$dir" && git pull)
fi
}
# Update FZF
run_in_dir_if_exists ~/.fzf "FZF" git pull && ./install --all --xdg
# Update Zsh
run_in_dir_if_exists ~/.zsh "Zsh" git pull && ./install
# Update Tmux Plugins
if [ -d ~/.tmux ]; then
echo "Updating Tmux plugins..."
update_git_repo ~/.tmux/tmux-onedark-theme "tmux-onedark-theme"
update_git_repo ~/.tmux/tmux-sensible "tmux-sensible"
update_git_repo ~/.tmux/tmux-prefix-highlight "tmux-prefix-highlight"
update_git_repo ~/.tmux/tmux-fzf "tmux-fzf"
else
echo "Tmux directory not found, skipping..."
fi
# Update Vim Plugins
run_if_command_exists vim "Vim plugins" vim +PluginUpdate +qall
# Update Homebrew
run_if_command_exists brew "Homebrew" brew update && brew upgrade
echo ""
echo "Don't forget to update zinit & its plugins..."
echo "Run: zinit self-update && zinit update --all"