# 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)