-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·63 lines (55 loc) · 2.57 KB
/
Copy pathinstall
File metadata and controls
executable file
·63 lines (55 loc) · 2.57 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
#!/bin/bash
# Install zsh using the appropriate package manager
if command -v dnf >/dev/null 2>&1; then
sudo dnf install -y zsh zoxide fzf
elif command -v yum >/dev/null 2>&1; then
sudo yum install -y zsh zoxide fzf
elif command -v apt >/dev/null 2>&1; then
sudo apt update && sudo apt install -y zsh zoxide fzf
else
echo "No supported package manager found (dnf, yum, apt)." >&2
exit 1
fi
# Distro packages sometimes lack zoxide; fall back to the upstream installer.
if ! command -v zoxide >/dev/null 2>&1; then
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
fi
# Same for fzf: install the binary only, without touching shell rc files.
if ! command -v fzf >/dev/null 2>&1; then
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --bin
fi
chsh -s $(which zsh)
# Install oh-my-zsh and powerlevel10k. This block is Zsh (anonymous function,
# ${rc:t}); the script itself is Bash.
zsh <<'EOF'
() {
emulate -L zsh -o xtrace -o err_return
ZDOTDIR=/no/such/dir command zsh -ic '[[ $ZDOTDIR == /no/such/dir ]]'
command mkdir -p -- ~/zsh-backup
local rc
for rc in ~/.zshenv ~/.zprofile ~/.zshrc ~/.zlogin ~/.zlogout ~/.oh-my-zsh; do
[[ -e $rc ]] || continue
[[ ! -e ~/zsh-backup/${rc:t} ]] || {
command rm -rf -- $rc
continue
}
command rm -rf -- ~/zsh-backup/${rc:t}.tmp.$$
command cp -r -- $rc ~/zsh-backup/${rc:t}.tmp.$$
command mv -- ~/zsh-backup/${rc:t}.tmp.$$ ~/zsh-backup/${rc:t}
command rm -rf -- $rc
done
command git clone -- https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
command git clone --depth=1 -- https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
command sed -- 's|robbyrussell|powerlevel10k/powerlevel10k|' ~/.oh-my-zsh/templates/zshrc.zsh-template >~/.zshrc
}
EOF
# zsh plugins
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --depth 1 https://github.com/unixorn/fzf-zsh-plugin.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-zsh-plugin
echo "Make sure you install the proper fonts on displaying host: https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraCode/Medium/FiraCodeNerdFont-Medium.ttf"
echo "Make sure you set your terminal to use the font"
SCRIPT_PATH=$(realpath "${BASH_SOURCE[0]}")
ln -s ${SCRIPT_PATH}/.tmux.conf ~/tmux.conf
ln -s ${SCRIPT_PATH}/.vimrc ~/.vimrc