-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZshInstaller.sh
More file actions
112 lines (90 loc) · 2.98 KB
/
Copy pathZshInstaller.sh
File metadata and controls
112 lines (90 loc) · 2.98 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# ---------- Zsh + Oh-My-Zsh + Powerlevel10k ----------
set -e
# 0) Пакеты
sudo dnf install -y zsh git curl util-linux-user
# 1) Установка Oh My Zsh без автозапуска и без смены shell
export RUNZSH=no
export CHSH=no
export KEEP_ZSHRC=yes
if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
# 2) Плагины и тема
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
[ -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ] || \
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
[ -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ] || \
git clone https://github.com/zsh-users/zsh-syntax-highlighting "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
[ -d "$ZSH_CUSTOM/plugins/zsh-completions" ] || \
git clone https://github.com/zsh-users/zsh-completions "$ZSH_CUSTOM/plugins/zsh-completions"
[ -d "$ZSH_CUSTOM/plugins/zsh-autocomplete" ] || \
git clone --depth=1 https://github.com/marlonrichert/zsh-autocomplete "$ZSH_CUSTOM/plugins/zsh-autocomplete"
[ -d "$ZSH_CUSTOM/themes/powerlevel10k" ] || \
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$ZSH_CUSTOM/themes/powerlevel10k"
# 3) Общие env для zsh
cat > "$HOME/.zshenv" <<'ZENV'
export DOTNET_ROOT="$HOME/.dotnet"
export PATH="$HOME/.dotnet:$HOME/.dotnet/tools:$PATH"
ZENV
# 4) Бэкап старого .zshrc
if [ -f "$HOME/.zshrc" ]; then
cp -f "$HOME/.zshrc" "$HOME/.zshrc.bak.$(date +%s)"
fi
# 5) Новый .zshrc
cat > "$HOME/.zshrc" <<'ZRC'
export ZSH="$HOME/.oh-my-zsh"
# Theme
ZSH_THEME="powerlevel10k/powerlevel10k"
# Plugins
# syntax-highlighting лучше оставлять последним
plugins=(
git
git-auto-fetch
npm
nvm
sudo
docker
docker-compose
dotnet
pip
kubectl
aliases
colorize
command-not-found
colored-man-pages
zsh-completions
zsh-autocomplete
zsh-autosuggestions
zsh-syntax-highlighting
)
source "$ZSH/oh-my-zsh.sh"
# Powerlevel10k config
[[ -f "$HOME/.p10k.zsh" ]] && source "$HOME/.p10k.zsh"
# История
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=$HOME/.zsh_history
setopt HIST_IGNORE_DUPS
setopt SHARE_HISTORY
# Удобства completion
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Настройки autosuggestions
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
bindkey '^ ' autosuggest-accept # Ctrl+Space принять подсказку
# Полезные алиасы
alias ll='ls -lah'
alias la='ls -A'
alias l='ls -CF'
alias cls='clear'
ZRC
# 6) Сделать zsh shell по умолчанию
if [ "$(basename "$SHELL")" != "zsh" ]; then
chsh -s "$(command -v zsh)"
fi
echo
echo "Готово."
echo "Перезапусти терминал или выполни: exec zsh"
echo "Потом запусти: p10k configure"
# ---------------------------------------------------