iTerm2
Mac OS
自带的终端,用起来虽然有些不太方便,界面也不够友好,iTerm2
是一款相对比较好用的终端工具.iTerm2
常用操作包括主题选择、声明高亮、自动填充建议、隐藏用户名和主机名、分屏效果等.
下载地址: https://www.iterm2.com/
安装Oh my zsh
Oh My Zsh
Oh My Zsh
它是基于zsh
命令行的一个扩展工具集,提供了丰富的扩展功能
Mac OS
系统默认使用dash
作为终端,可以使用命令修改默认使用zsh
:
chsh -s /bin/zsh
curl 安装方式
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
wget 安装方式
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
oh-my-zsh 开源地址
安装Powerline
Powerline
是一款比较炫酷的状态栏工具
使用python
的pip
命令安装Powerline
pip install powerline-status --user
安装PowerFonts
安装字体库需要首先将项目git clone至本地,然后执行源码中的install.sh。
安装好字体库之后,我们来设置iTerm2的字体,具体的操作是iTerm2 -> Preferences -> Profiles -> Text,在 Font 区域选中Change Font,然后找到 Meslo LG字体。有L、M、S可选,看个人喜好
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
主题选择
oh-my-zsh 主题选择
修改
~/.zshrc
文件ZSH_THEME=主题
,然后执行source
命令使配置生效
安装配色方案
配色方案在使用
VIM
或Colorful Log
时会变得非常有用,同时界面也不会一片黑绿一样死板。
git clone https://github.com/altercation/solarized
cd solarized/iterm2-colors-solarized/
open .
在打开的
Finder
窗口中,双击 Solarized Dark.itermcolors 和 Solarized Light.itermcolors 即可安装明暗两种配色
进入 iTerm2 -> Preferences -> Profiles -> Colors -> Color Presets 中根据个人喜好选择
命令补全插件
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
vi ~/.zshrc
打开
~/.zshrc
文件进行编辑。找到 plugins,加上命令补全插件
安装高亮插件
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
vi ~/.zshrc
打开
~/.zshrc
文件进行编辑。找到 plugins,请把高亮插件放在最后
快捷键
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 + l 清屏
ctrl + a 到行首
ctrl + e 到行尾
ctrl + f/b 前进后退
ctrl + p 上一条命令
ctrl + r 搜索命令历史