OhMyZsh 配置

安装 zsh

ubuntu 下:

sudo apt-get install zsh

mac下:

brew install zsh

后面的内容两个系统通用

安装 oh-my-zsh

wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

然后给install.sh添加权限:

chmod +x install.sh

然后执行install.sh

./install.sh

如果发现很慢,可以修改为gitee

vim install.sh

进入编辑状态:
找到以下部分:

# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}

然后将中间两行改为:

REPO=${REPO:-mirrors/oh-my-zsh}
REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}

然后保存退出:ESC + :wq
重新执行即可。

配置 zsh

vim ~/.zshrc

修改主题:#

ZSH_THEME="robbyrussell"

改为

ZSH_THEME="ys"

修改插件:#

plugins=(git)

改为

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
  • 如果.bash_profile中有配置内容的话,还需要增加一行:
source ~/.bash_profile

接下来我们可以更新配置文件:

source .zshrc

发现同上报错是正常的,因为我们还没有下载插件,直接就配置了。

安装插件

1. 安装zsh-syntax-highlighting#

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • 用不了 Github的, 可以用下面这个 gitee的
git clone https://gitee.com/zjy_1671/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

2. 安装zsh-autosuggestions#

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  • 用不了 Github的, 可以用下面这个 gitee的
git clone https://gitee.com/chenweizhen/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

安装完成后,重新更新配置:

source .zshrc

在编辑指令的时候,对于之前使用过的指令,按即可快速补全,非常好用。

作者:daizixuan

出处:https://www.cnblogs.com/daizixuan/p/17957604

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

转载请标明出处

posted @   daizixuan  阅读(75)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
more_horiz
keyboard_arrow_up light_mode palette
选择主题
menu
点击右上角即可分享
微信分享提示