1. 当前shell
echo $0
-zsh
2. 切换为zsh,提示符变为%了,不习惯
chsh -s /bin/zsh
3. 安装iTerm2
直接https://www.iterm2.com/,官网下载直接安装即可,方便
4. 安装ohMyZsh
#有坑有坑,注意下面是国内地址,国外地址会报443错误,可能因为我没有翻墙
sh -c "$(curl -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"
#github地址:
#sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
#另一国内同步地址 https://gitee.com/mirrors/oh-my-zsh.git
5. 安装pip
sudo easy_install pip
6. powerline安装
#安装powerline
pip install powerline-status --user
#安装powerFont字体
mkdir powerFont #建立临时目录
git clone https://github.com/powerline/fonts.git --depth=1 #克隆字体,慢慢慢!!!
#有可能会出现如下错误
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
#输入如下命令可以解决
git config --global core.compression 0
cd fonts #进入字体目录
./install.sh #安装字体
7. cmd+, 选择字体
Preferences -> Profiles -> Colors
ps:我喜欢menlo
Preferences -> Profiles -> Colors 中有Foreground是标准字体颜色,ANSI Colors中Bright的第一个是补全的字体颜色。
8. 安装配色方案
mkdir itermColor #可选,git会自动创建,可以进入目录再clone,不进入就是当前目录
git clone https://github.com/altercation/solarized #慢慢慢!!!
#可能会出现如下错误
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
#需要设置postbuffer大小
git config --global http.postBuffer 524288000
git config --list
9. 选择配色方案
#切换目录
cd solarized/iterm2-colors-solarized
open .
点击文件完成导入
image.png
10. 安装主题
#clone,agnoster主题
git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git
#切换目录
cd oh-my-zsh-agnoster-fcamblor/
#执行安装
./install
#如果安装完成,目录下没有.zshrc,则执行cp操作
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
#切换回~
cd ~
vim .zshrc
**编辑ZSH_THEME后面的字段改为agnoster**
**user@userdemackbookPro这样的提示符太长了,可以直接在.zshrc最后加上**
DEFAULT_USER="user"
***DEFAULT_USER 的值必须要是系统用户名才能生效
退出vim后执行source ~/.zshrc,每次修改.zshrc都要执行***
可能会出现“?”情况,是字体不支持ascii码字符,换成一个支持的即可
11. 安装高亮插件
#切换目录
cd ~/.oh-my-zsh/custom/plugins/
#clone文件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
#编译配置
vim ~/.zshrc
# plugins 中,git后追加 zsh-syntax-highlighting
plugins=(
git
zsh-syntax-highlighting
)
#最后一行追加
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
12. 自动提示插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# 打开.zshrc在plugins里添加zsh-autosuggestions,放在高亮插件前面
vim ~/.zshrc
source ~/.zshrc
完美的分隔线
将来可能用到:卸载oh my zsh
进入到.oh-my-zsh/tools目录,执行shell命令 ./uninstall.sh
会提示不让执行shell命令
解决办法
输入 chmod +x uninstall.sh
然后再执行 ./uninstall.sh ,发现oh-my-zsh被卸载
最后删除.zshrc文件
如果在过程中有遇到git、brew等命令特别慢,可以更改下国内镜像。
网友评论