oh-my-zsh 终端主题

Nan (/)
2023-10-10T14:38:00+08:00

shell

一安装 zsh

# 安装
sudo apt-get install zsh

# 查看支持的终端列表
cat /etc/shells

# 更改默认终端
chsh -s /bin/zsh
# 查看默认终端
echo $SHELL

# 重启
sudo reboot

二安装 oh-my-zsh

# 切换至root用户
sudo su
# 下载
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

# 更改权限
chmod +x install.sh

# 执行安装
./install.sh
# 安装不上需替换
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
# 替换为
REPO=${REPO:-mirrors/oh-my-zsh}
REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}

# 移除命令
rm -r /root/.oh-my-zsh

三 修改主题

# 修改配置
nano ~/.zshrc
# ZSH_THEME="robbyrussell"
ZSH_THEME="af-magic"

# 更新
source ~/.zshrc

四安裝插件

# 自动补全插件
# 下载：https://mimosa-pudica.net/zsh-incremental.html
# 安装： 新建目录/新建文件/复制下载文件中代码至新文件中
cd ~/.oh-my-zsh/plugins/
mkdir -p incr
cd incr
touch incr-0.2.zsh
nano incr-0.2.zsh

# 自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
# 高亮正确语法
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting


# 修改配置
nano ~/.zshrc
plugins=( zsh-syntax-highlighting zsh-autosuggestions )
source ~/.oh-my-zsh/plugins/incr/incr-0.2.zsh

# 更新
source ~/.zshrc