oh-my-zsh

Posted by wanglilong on April 21, 2022

Shell 工具

Shell是在程序员与服务器间建立一个桥梁,它对外提供一系列命令。

安装oh-my-zsh

1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

配置主题

oh-my-zsh自带100多个主题,主题的配置文件在 ~/.zshrc文件中,找到这一行:

1
ZSH_THEME="robbyrussell"

你可以将值改成任意主题,oh-my-zsh的主题可以在这里找到。保存好文件后,执行 source ~/.zshrc 使配置生效。如果你将值设为空,表示不使用任何主题

安装插件

语法高亮插件zsh-syntax-highlighting :输入的命令中间有错的时候会自动显示红色

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

自动补全插件 zsh-autosuggestions

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

启用插件

在配置文件在 ~/.zshrc文件

1
2
3
4
5
6
7
# 找到plugins后括号里添加安装的插件名字
plugins=( git 
          zsh-autosuggestions 
          zsh-syntax-highlighting
        )
# 最后刷新
source ~/.zshrc