tags: 软件配置/linux 软件配置/oh-my-zsh 软件配置/zsh

1. 安装zsh

本教程的为Ubuntu下操作。

1
2
3
4
5
6
7
8
9
10
11
#安装zsh
sudo apt install zsh

# 输出本机
echo $SHELL

# 修改本机默认shell (交互式修改)
chsh

# 修改默认Shell为zsh
chsh -s /bin/zsh

2 . 安装oh-my-zsh

1
2
3
4
5
# gitee
sh -c "$(curl -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"

# github
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"****

如果使用官方的github源,速度可能有点慢。因此可以使用改造过的gitee源,若失效,百度即可。

3. 相关文件

  • 配置文件位置位于 ~/.zshrc
  • oh-my-zsh 的数据文件位于 ~/.oh-my-zsh 文件夹下

当需要修改主题或者插件时,可以直接在配置文件中进行修改。需要下载新的插件和主题时,需要放入 .oh-my-zsh文件夹中的相应位置。

4. 安装插件

1
2
3
4
5
6
7
8
9
10
11
#插件推荐
plugins=(
zsh-autosuggestions
zsh-syntax-highlighting
zsh-history-substring-search
z
extract
git)

#自带插件
z、extract、sudo、git

推荐下载插件:

1
2
3
4
5
6
7
8
# 语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# 命令建议
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-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

5. 修改主题

1
ZSH_THEME="ys"

6. 其他

  • 其他具体细节可以查看 oh-my-zsh官网
  • Mac安装和Linux步骤非常相似,不再赘述。