1 Mac安装
1.1 安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 1
1.2 配置主题颜色
vim ~/.zshrc ZSH_THEME="robbyrussell"改为ZSH_THEME="agnoster" 12
图1.1为安装oh-my-zsh及进入配色方案入库示意图.
![在这里插入图片描述](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153809_bk4e_k87qd5s.jpg)
图1.2为进入配色编辑,设置颜色.
![配色](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153809_bk4e_kr14vbfc.jpg)
1.3 效果图
图1.3为安装后的效果,出现乱码,需要安装Powerline字体.
![在这里插入图片描述](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153809_bk4e_dk20ri58.jpg)
图1.3 oh-my-zsh效果
1.4 安装Powerline字体
git clone https://github.com/powerline/fonts.git cd fonts ./install.sh 123
1.5 配置终端字体
图1.4为配置终端字体格式,调整为Meslo LG S DZ Regular Powerline
![在这里插入图片描述](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153810_bk4e_qrbaads.jpg)
图1.4 Mac终端配置字体
1.6 最终效果
图1.5 为终端效果图
![效果](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153810_bk4e_tl220enc.jpg)
图1.5 终端效果
2 Ubuntu安装
2.1 安装curl
sudo apt install curl 1
2.2 安装zsh
sudo apt-get install zsh 1
2.3 安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 1
2.4 配置颜色
vim ~/.zshrc ZSH_THEME="robbyrussel"修改为ZSH_THEME="agnoster" 12
图2.1为安装oh-my-zsh及配色入口.
![URL](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153811_bk4e_6d96cd4.jpg)
2.5 安装Powerline字体
git clone https://github.com/powerline/fonts.git cd fonts ./install.sh 123
2.6 bash与zsh切换
# bash ⇒ zsh chsh -s /bin/zsh root或者直接zsh # zsh ⇒ bash chsh -s /bin/bash或者直接bash 1234
2.7 配置终端
图2.2为终端配置字体.
![URL](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153811_bk4e_lf109ijg.jpg)
重启机器,打开终端,即可得到如图2.3所示的最终效果图.
![URL](http://img.huajiangbk.com/upload/news/2024/1106/photos/middle/20241106153811_bk4e_9k1iqg7o.jpg)
3 oh-my-zsh命令
3.1 查看oh-my-zsh主题
ls ~/.oh-my-zsh/themes 1
3.2 查看插件
ls ~/.oh-my-zsh/plugins 1
3.3 自动补齐插件
# 获取 wget http://mimosa-pudica.net/src/incr-0.2.zsh # plugins文件夹新建incr文件夹 cd ~/.oh-my-zsh/plugins mkdir incr # 复制下载文件到plugins cp incr-0.2.zsh ~/.oh-my-zsh/plugins/incr # 使插件生效 source ~/.oh-my-zsh/plugins/incr/incr-0.2.zsh 123456789
3.4 卸载oh-my-zsh
uninstall_oh_my_zsh 1
3.5 插件配置与激活
# 以自动补补全插件为例incr-0.2.zsh # 建立incr文件夹 cd ~/.oh-my-zsh/plugins mkdir incr # 编辑zshrc文件 vim ~/.zshrc # 找到plugins,添加需要激活的插件 plugins=(git incr) # 进入插件目录 cd ~/.oh-my-zsh/plugins/ # 进入对应插件目录 cd incr # 修改文件名称为标准命名 # 下载源插件名称为`incr-0.2.zsh` # 修改为 incr.plugin.zsh
12345678910111213141516