下载 iterm2
配置
1.设置 itemr2 为默认终端
屏幕快照 2020-03-28 11.04.29.png2.设置 iterm 主题
Preferencess -> profiles -> Colors
点击 Color Preset
选择 Solarized Dark
安装 on-my-zsh
1.设置默认shell,base 设为 zsh
屏幕快照 2020-03-28 11.19.16.png该操作会要求输入开机密码,并且设置完后要重启生效
2.安装 on-my-zsh
GitHub 地址 https://github.com/ohmyzsh/ohmyzsh
github 内有安装方式
我用的是 curl 方式
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
3.设置 on-my-zsh 主题
GitHub 主题预览 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
githbu 主题列表 https://github.com/ohmyzsh/ohmyzsh/tree/master/themes
在 ~/ 目录下的 .zshrc 文件修改主题
ZSH_THEME="agnoster"
设置完后
source ~/.zshrc
主题就生效了,但是有乱码,要安装字体文件屏幕快照 2020-03-28 11.33.27.png
powerline 字体文件 https://github.com/powerline/fonts
网上的教程都是用 Meslo LG S Regular
字体,我也用这个
下载地址:https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG%20S%20Regular%20for%20Powerline.ttf
下载之后安装到电脑上
安装之后打开 Preferencess -> Profiles -> Text
,在 font 选项中 选择 Meslo LG S Regular
字体,字号也可以根据自己的习惯修改
语法高亮
GitHub 语法高亮插件地址 https://github.com/zsh-users/zsh-syntax-highlighting
可以在里边找安装方式
我把语法高亮插件和自动提示插件都放到 ~/.oh-my-zsh/custom/plugins
文件夹下,按照 GitHub 的命令去安装
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
安装之后启用语法高亮插件
source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
自动补全
GitHub 自动提示地址 https://github.com/zsh-users/zsh-autosuggestions
同样安装在 ~/.oh-my-zsh/custom/plugins
文件夹
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
然后编辑 ~/.zshrc
文件,找到 plugins
配置项,默认为 plugins=(git)
,添加zsh-autosuggestiongs
插件
保存退出,退出后
source ~/.zshrc
,自动提示插件就已经生效了,但是到现在有可能还是看不到提示,这是提示文字的颜色导致的
cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
vi zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
// 默认 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
关闭终端在打开就能看见提示了。如果还看不见,可以 source ./zsh-autosuggestions.zsh
,关闭终端再打开。
网友评论