MAC上iTerm 2安装与使用

logo2x.jpg

更新日志

1、前言

iTerm2是MAC下最好用的终端工具,而且仍是免费的。iTerm2 是配置完毕开箱即用的 tmux,有标签变色、智能选中等特点功能。在平常开发中,咱们不免会与终端命令打交道,好比使用Git,CocoaPods,Homebrew,Hexo等,下面开始介绍自定义终端样式吧!python

2、目录

3、下载安装iTerm 2

4、安装powerline

//没有安装pip先安装pip
sudo easy_install pip

//以后安装powerline(这里可能会报错,能够参考问题解决)
pip install powerline-status
复制代码

5、安装oh-my-zsh

curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
复制代码

6、安装字体库fonts

//克隆字体库到本地
git clone https://github.com/powerline/fonts.git

//安装字体
cd fonts
./install.sh
复制代码

安装成功以后输出:git

➜  fonts git:(master) ./install.sh
Copying fonts...
Powerline fonts installed to /Users/WENBO/Library/Fonts
复制代码

7、导入配色

git clone https://github.com/altercation/solarized
复制代码
  • 解压zip文件,进入solarized/iterm2-colors-solarized 文件,双击Solarized Dark.itermcolorsSolarized Light.itermcolors进行安装导入,以下图所示
    install-solarized.png
  • 进入系统偏好设置,profiles->Colors选择刚刚导入的配色方案便可
    屏幕快照 2018-02-12 下午4.07.41.png

8、主题设置

//克隆主题到本地
git clone  https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor

//安装主题
cd oh-my-zsh-agnoster-fcamblor
./install
复制代码
  • 安装成功以后,编辑**~/.zshrc文件,将ZSH_THEME改成agnoster**
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
复制代码

9、添加指令高亮效果zsh-syntax-highlighting

  • 下载文件
//克隆项目到本地
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
复制代码
  • 编辑**.zshrc**文件,在最后添加以下内容
source /Users/WENBO/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
plugins=(zsh-syntax-highlighting)
复制代码

注意github

/Users/WENBO是*.zshrc文件所在路径,这里替换成你本身的就行了
复制代码
  • 设置成功以后,效果以下:
    屏幕快照 2018-02-12 下午4.55.25.png

10、快捷键

本身也才安装,先记录下来吧。bash

说明 快捷键
新建标签 command + t
关闭标签 command + w
切换标签 command + 数字 command + 左右方向键
切换全屏 command + enter
查找 command +f
垂直分屏 command + d
水平分屏 command + shift + d
切换屏幕 command + option + 方向键 command + [ 或 command + ]
查看历史命令 command + ;
查看剪贴板历史 command + shift + h
清除当前行 ctrl + u
到行首 ctrl + a
到行尾 ctrl + e
前进后退 ctrl + f/b (至关于左右方向键)
上一条命令 ctrl + p
搜索命令历史 ctrl + r
删除当前光标的字符 ctrl + d
删除光标以前的字符 ctrl + h
删除光标以前的单词 ctrl + w
删除到文本末尾 ctrl + k
交换光标处文本 ctrl + t
清屏1 command + r
清屏2 ctrl + l

11、问题解决

sudo mkdir /usr/local/Frameworks
sudo chown $(whoami):admin /usr/local/Frameworks
复制代码

以后执行,连接成功dom

brew link python
复制代码
  • 安装powerline报错Permission denied,缘由是没有安装python,,经过homebrew安装python
brew install python
复制代码
  • 命令显示?号,以下图所示:
    屏幕快照 2018-02-12 下午4.38.27.png
    解决办法:进入Preference->Profiles->Text,作以下配置便可:
    屏幕快照 2018-02-12 下午4.59.18.png
  • Mac安装powerline 权限问题,报错以下
    屏幕快照 2018-05-20 下午3.57.18.png
    解决办法:
pip install powerline-status --user -U
复制代码

12、结语

在掘金上发现了这款终端工具,本身平时也有用到终端工具,因而就尝试给本身的MAC装上这款软件,在安装过程当中仍是遇到一些问题,不过最后都解决了。若是你也爱好终端命令操做,能够尝试DIY你喜欢的终端样式哦。curl

参考文章

相关文章
相关标签/搜索