Linux + zsh + oh-my-zsh
谁用谁知道的上佳效果:
安装步骤
现在网上很多都是直接从github上拉去install.sh的,老是被墙,麻了,所以特地做个不墙的教程
环境准备
环境 | 参数 |
---|---|
操作系统 | CentOS 7(这个无所谓,一般的x64操作系统都ok) |
软件环境 | zsh,Git(没有就用yum先装上) |
切换系统命令行软件
chsh -s /bin/zsh
下载
方法一:直接克隆项目
建议从gitee上克隆,不会被墙(gitee.com/mirrors/oh-… )
当然,用gitclone这家网站也可以,它里面教你怎么弄(gitclone.com/ )
- 克隆项目:
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh
或
git clone https://gitclone.com/github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
2. 直接复制配置文件
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
3. 配置生效:source ~/.zshrc
方法二:使用install.sh
怎么说呢,其实这个可执行文件就在上面克隆项目里的/tools/install.sh
网上一般都会发:
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
换成gitee或者加上gitclone.com就行了
插件安装
我推荐两款插件
- 历史记录补全
git clone https://gitee.com/yuhldr/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
2. 代码高亮
git clone https://gitee.com/szdongxf/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
主题配置与生效
vim ~/.zshrc
我们更改第11行:ZSH_THEME="ys"
,这个主题贴主极力推荐。其他主题可以参考www.zhihu.com/question/33…
我们随后更改73行的plugin部分:
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
保存退出
source ~/.zshrc
就完成啦