# myzsh 安装与配置

### Check the env

```
cat /etc/shells 

```

[![](http://www.netflt.com/uploads/images/gallery/2024-08/scaled-1680-/TxQN9Vo7JYQbvuKm-image-1723181940883.png)](http://www.netflt.com/uploads/images/gallery/2024-08/TxQN9Vo7JYQbvuKm-image-1723181940883.png)

### Install zsh

```
sudo apt-get install zsh
## replace zsh as default shell manager
sudo chsh -s $(which zsh) $USER

```

[![](http://www.netflt.com/uploads/images/gallery/2024-08/scaled-1680-/LWnBH59Litac4Bu3-image-1723181948839.png)](http://www.netflt.com/uploads/images/gallery/2024-08/LWnBH59Litac4Bu3-image-1723181948839.png)

### Install oh-my-zsh

```
sudo apt-get install wget
sudo apt-get install git

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

```

[![](http://www.netflt.com/uploads/images/gallery/2024-08/scaled-1680-/oyFLmvZwtcxuP0L2-image-1723181959516.png)](http://www.netflt.com/uploads/images/gallery/2024-08/oyFLmvZwtcxuP0L2-image-1723181959516.png)

### Install plugin

```

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

```

### Edit myzsh theme

```
vim ~/.zshrc
##add plugin
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
### select a theme
ZSH_THEME="ys"
source ~/.zshrc 

```

### Install autojump

```
sudo apt-get install autojump

# add autojump.zsh in .zshrc
. /usr/share/autojump/autojump.zsh





```

### oh-my-zsh 在 `git` 目录下执行命令会卡顿明显，简单的 `cd` 和 `ls` 都会。

> ##### 原因:
> 
> 插件会读取 git 的配置信息，如果项目目录下有太多的文件，卡顿会非常明显。可以使用以下命令禁止 zsh 自动获取 git 信息，解决卡顿问题：
> 
> ##### 解决：
> 
> 1. 设置 oh-my-zsh 不读取文件变化信息  
>     git config --add oh-my-zsh.hide-dirty 1
> 2. 设置 oh-my-zsh 不读取任何 git 信息  
>     git config --add oh-my-zsh.hide-status 1
> 3. 全局设置 oh-my-zsh 不读取文件变化信息  
>     git config --global oh-my-zsh.hide-dirty 1
> 4. 全局设置 oh-my-zsh 不读取任何 git 信息  
>     git config --global oh-my-zsh.hide-status 1

[![](http://www.netflt.com/uploads/images/gallery/2025-01/scaled-1680-/OHMt4bXvftK8cexY-image-1735725824393.png)](http://www.netflt.com/uploads/images/gallery/2025-01/OHMt4bXvftK8cexY-image-1735725824393.png)

[![](http://www.netflt.com/uploads/images/gallery/2025-01/scaled-1680-/8u2s8LMO7mmSPtWY-image-1735726419540.png)](http://www.netflt.com/uploads/images/gallery/2025-01/8u2s8LMO7mmSPtWY-image-1735726419540.png)