【1.2】iTerm2简介

iterm2是一个更好替代Mac自带终端与iterm的软件。iTerm2 is a replacement for Terminal and the successor to iTerm.It works on Macs with OS 10.5 (Leopard) or newer. iTerm2 brings the terminal into the modern age with features you never knew you always wanted.

官网:http://iterm2.com/

中文官网: http://www.iterm2.cn/  更多具体用法参见该地址

使用手册:http://www.iterm2.cn/guide

一、下载

直接在官网上点击下载即可。

二、常用的几个快捷方式

1.复制

方法一:一种是用鼠标,在iterm2中,选中某个路径或者某个词汇,那么,iterm2就自动复制了。

方法二:

无鼠标模式,command+f,弹出iterm2的查找模式,输入要查找并复制的内容的前几个字母,确认找到的是自己的内容之后,输入tab,查找窗口将自动变化内容,并将其复制。如果输入的是shift+tab,则自动将查找内容的左边选中并复制。

2.路径重复在新Tab中自动使用前一Tab路径

在profiles修改general中得working directory—reuse previous session’s directory

3.屏幕切割

屏幕切割command+d:垂直分割;
command+shift+d:水平分割
全屏切换command+enter进入与返回全屏模式
删除当前光标的字符:ctrl + d

4.调用与隐藏iterms

系统热键如下图,设置好系统热线之后,将在正常的浏览器或者编辑器等窗口的上面,以半透明窗口形式直接调出iterm2 shell。

profiles—general—keys—hotkey
ctrl+alt+t

5.修改颜色

第一步:

vim ~/.bash_profile

#enables colorin the terminal bash shell export
CLICOLOR=1
#sets up thecolor scheme for list export
LSCOLORS=gxfxcxdxbxegedabagacad
#sets up theprompt color (currently a green similar to linux terminal)
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
#enables colorfor iTerm
export TERM=xterm-color

每行代码的作用都有英文注释,大家有不明白的地方可以看这个英文注释。

第二步,为iTerm2设置喜爱的配色方案。

打开iTerm2的使用偏好设置,选择profiles,然后选择Colors标签,然后进行颜色配置。用户也可以点击“Load Presets…”按钮加载一些经典的配色方案。

给大家推荐一个托管在github上的关于iterm2配色方案的项目。地址是https://github.com/baskerville/iTerm-2-Color-Themes。

这个项目中包含了很多种配色方案,用户可以挑选喜欢的方案通过点击“Load Presets…“按钮导入这些配色方案进行使用。

参考资料:

iTerm2新手应知特色功能介绍 http://www.iterm2.cn/articles/1100000001/4190ab01001000001

iTerm2 快捷键汇总 http://www.iterm2.cn/article/s/1100000001/4190ab01001000002

药企,独角兽,苏州。团队长期招人,感兴趣的都可以发邮件聊聊:tiehan@sina.cn
个人公众号,比较懒,很少更新,可以在上面提问题,如果回复不及时,可发邮件给我: tiehan@sina.cn