CentOS7 源码安装 zsh 及 配置 Oh my zsh
因为一些国内不能访问 github,所以本教程使用的 gitee 下载源文件。
环境
Centos7 最小化安装环境
源码编译安装
如果需要安装 powerlevel10k 则需要源码安装最新版本,yum源中的5.0.2版本是不支持的
1 | yum -y install wget git gcc ncurses-devel |
更改默认终端
1 | chsh -s /usr/local/bin/zsh |
这时候打开终端软件,应该就会默认进入 zsh 了。
如果 shell 连接进入 bash 则需要重启一下系统
配置 oh-my-zsh
- 从 gitee 拉取 oh-my-zsh
国内镜像源(每日更新一次)
1 | git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh |
- 默认配置
1
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
安装插件
zsh-syntax-highlighting 命令高亮插件
1 | git clone https://gitee.com/dawnwords/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting |
zsh-autosuggestions 自动建议补全
1 | git clone https://gitee.com/lhaisu/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions |
安装 autojump 目录跳转
1 | git clone https://gitee.com/gentlecp/autojump.git |
执行成功后将出现的代码复制到 .zshrc 末尾处,可能有少许差异,不生效则需要以下面模版进行修改。
1 | vim ~/.zshrc |
插件配置
同样是打开.zshrc文件,找到plugins=(git),在这里增加自己想要的插件即可,多个插件名称之间使用空格或者换行分开(不能使用逗号)。vim ~/.zshrc
1 | plugins=( |
每次修改完 .zshrc 都需要
1 | source ~/.zshrc |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment