iTerm2高定

325 阅读1分钟

1、下载iTerm2

官网下载:www.iterm2.com/

安装完成后,在/bin目录下会多出一个zsh的文件

// 修改默认终端使用zsh
chsh -s /bin/zsh 
// 改回默认dash 
chsh -s /bin/bash

2、安装Oh my zsh

开源地址:github.com/robbyrussel…

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

// 安装报错: curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443 
// 解决方法: 
brew install nss

3、安装PowerLine

powerline官网:powerline.readthedocs.io/en/latest/i…

// 安装pip 
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py 
python get-pip.py

sudo easy_install pip 

pip install powerline-status

4、安装PowerFonts

// save path 
cd ~/Desktop 

// git clone 
git clone https://github.com/powerline/fonts.git --depth=1 

// cd to folder
cd fonts

// run install shell 
./install.sh

设置iTerm2的字体,iTerm2 -> Preferences -> Profiles -> Text,在Font区域选中Change Font

image.png

5、安装主题

github.com/fcamblor/oh…

下载agnoster主题,执行脚本安装:

cd ~/Desktop 

git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git 

cd oh-my-zsh-agnoster-fcamblor/ 

./install

执行上面的命令会将主题拷贝到oh my zsh的themes中。

拷贝完成后,执行命令打开zshrc配置文件,将ZSH_THEME后面的字段改为agnoster。

// 修改前 
ZSH_THEME="robbyrussell" 

// 修改后
ZSH_THEME="agnoster"

配色方案

cd ~/Desktop 

git clone https://github.com/altercation/solarized 

cd solarized/iterm2-colors-solarized/

open .

在打开的finder窗口中,双击Solarized Dark.itermcolors和Solarized Light.itermcolors即可安装明暗两种配色

image.png

6、安装插件

插件库:github.com/robbyrussel…

这里面的插件复制进plugins文件夹下,增加plugins即可

自动补全插件

cd ~/.oh-my-zsh/custom/plugins/ 

// 下载插件
git clone https://github.com/zsh-users/zsh-autosuggestions 

vim ~/.zshrc 

// 编辑插件 
plugins=( 
        git
        zsh-autosuggestions
) 

// 保存退出
:wq 

// 生效 source ~/.zshrc

自动高亮插件

github.com/zsh-users/z…

cd ~/.oh-my-zsh/custom/plugins/ 

// 下载到plugins下 
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting 

// 编辑~/.zshrc文件将然后将插件引用命令写入该文件最后一行 
source "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"

小彩蛋:

brew install cowsay 
brew install fortune 

// 打印所有cowsay 
face for i in $(cowsay -l); do cowsay -f $i "$i"; done 

// vm ~/.zshrc追加一行 
fortune | cowsay
brew install figlet
brew install lolcat 

// vm ~/.zshrc追加一行 
figlet Ni YongSheng | lolcat

image.png