# zsh
> https://www.unixmen.com/install-oh-zsh-ubuntu-arch-linux-fedora/
既然是用 Linux 当然没有忘记把 bash 换成 [zsh](Oh My Zsh)
1. 首先是安装 zsh: `sudo pacman -S zsh`
2. 接着配置 oh-my-zsh:`sh -c "$(curl -fsSL https://raw.fastgit.org/ohmyzsh/ohmyzsh/master/tools/install.sh)"`
[ohmyzsh的安装过程中失败拒绝连接问题的解决](https://www.cnblogs.com/fcchen/p/12914066.html)
3. 最后更换默认的 shell: `chsh -s /bin/zsh`
## 插件
~~~
plugins=(
git
z
sudo
zsh-autosuggestions
zsh-syntax-highlighting
zsh-better-npm-completion
history
history-substring-search
node
npm
wd
web-search
last-working-dir
)
~~~
插件
~~~
# zsh-autosuggestions 历史记录插件:
git clone https://hub.fastgit.org/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 高亮你的zsh可用命令插件
git clone https://hub.fastgit.org/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# Better completion for npm
git clone https://hub.fastgit.org/lukechilds/zsh-better-npm-completion ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-better-npm-completion
~~~
### incr 补全插件
让你在zsh 模式下全自动补全指令或目录
官网: http://mimosa-pudica.net/zsh-incremental.html
1. 下载插件
```
wget https://mimosa-pudica.net/src/incr-0.2.zsh
```
2. 加载插件
然后是配置 .zshrc 文件:
~~~
➜ vim ~/.zshrc
~~~
然后插入一句下面的 shell 脚本:
~~~
source ~/.oh-my-zsh/plugins/incr/incr*.zsh
~~~
重启之后就就可以愉快的使用 zsh 了~
> [zsh-incr自动补全插件](https://xuanyu.li/2018/04/12/zsh-incr)
## 设置主题
修改配置文件 `vim ~/.zshrc` 中的 ZSH_THEME 来设置使用的风格
~~~
ZSH_THEME="cypher"
~~~
系统内置了超级多的themes,
可以进入文夹`~/.oh-my-zsh/themes`中进行查看,自行选择喜欢的,还可以自行配置。
~~~
cd ~/.oh-my-zsh/themes
ls
~~~
## powerlevel10k
```zsh
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
```
`~/.zshrc` 修改,保存退出:
```
ZSH_THEME="powerlevel10k/powerlevel10k"
```
打开后自动提示配置,或者配置命令:
```
p10k configure
```
配置后生成的配置文件:`~/.p10k.zsh`
字体可选:
Operator Mono Lig
Dank Mono
[JetBrains Mono](https://www.jetbrains.com/lp/mono/#how-to-install)
> 参考:[powerlevel10k](https://gitee.com/romkatv/powerlevel10k#manual)