Iterm2配置
-
下载iterm2
https://www.iterm2.com/index.html -
下载oh-my-zsh
方式一:一键安装
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
注意:如果有连接异常,可以配置hosts 解决:
- 访问 https://www.ipaddress.com/ 输入 raw.githubusercontent.com 得到ip;
- sudo /private/etc/hosts 添加例如: 199.232.68.133 raw.Githubusercontent.com 到hosts文件中
- 再次运行以上sh -C …将能安装成功
- oh-my-zsh目录介绍:
➜ .oh-my-zsh (master) ✗ ls
CODE_OF_CONDUCT.md cache oh-my-zsh.sh tools
CONTRIBUTING.md custom plugins
LICENSE.txt lib templates
README.md log themes
主要关注themes(存放主题文件,后期其他主题文件可直接拷贝到此目录),plugins(插件目录,后期下载插件直接放入此目录减少配置)
- 查看本机shell是否为zsh
➜ ~ echo $SHELL
/bin/zsh
如果输出 /bin/zsh 则无需修改,如果不是则运行如下命令切换默认shell为zsh
$ chsh -s /bin/zsh
- 备份配置文件
$ cp ~/.zshrc ~/.zshrc.orig
- 复制一个新的配置文件
$ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
- 打开终端,进入自己项目空间目录 克隆主题
$ git clone https://github.com/dracula/zsh.git
- 移动主题文件dracula.zsh-theme到~/.oh-my-zsh/themes/下
- 修改zsh配置文件
➜ ~ vim .zshrc
# export PATH=$HOME/bin:/usr/local/bin:$PATH
ZSH_DISABLE_COMPFIX="true"
# Path to your oh-my-zsh installation.
export ZSH="/Users/hanpengfei/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="dracula"
!wq保存退出。
到这里,已经完成了zsh主题的配置,但是距离效果图还差那么一点点,那就是iterm2的主题和命令高亮插件。
-
更换iterm2的主题为Dracula
下载iterm2的Dracula主题
$ git clone https://github.com/dracula/iterm.git
设置主题:
iTerm2 > Preferences > Profiles > Colors Tab
Open the Color Presets…
从列表中选择import
选择刚才下载主题中Dracula.itermcolors 文件,确定
再次打开Color Presets… ,选择Dracula
10 . 配置高亮插件(其他插件类似)
直接将插件克隆到:~/.oh-my-zsh/plugins 目录下
➜ plugins (master) ✗ git clone https://github.com/zsh-users/zsh-syntax-highlighting
- 修改 .zshrc文件
vim ~/.zshrc
plugins配置需要使用的插件
plugins=(git zsh-autosuggestions web-search)
退出并保存 !wq
12 . 生效修改
source ~/.zshrc