iTerm2
iTerm一個為Mac OS X編寫的,功能齊全的終端仿真程序;目標是在為用戶提供OS X下最佳的命令行體驗,iTerm 2有很多能夠提升效率的實用功能。比如說窗口分割、熱鍵窗口、智能搜索、自動完成、快速復制等等,其他功能可查看官網的Features頁。
Term2的安裝與配置
- 第一種直接從官網下載安裝包
- 第二種使用 Homebrew 命令
brew cask install iTerm2
安裝(推薦) - 安裝后在啟動台啟動iTerm,快捷鍵command+,調起配置框
配置環境變量
- open ~/.zshrc
- 添加 source ~/.bash_profile
Oh My Zsh的安裝
Oh My Zsh是對主題的進一步擴展,地址:https://github.com/robbyrussell/oh-my-zsh
- 一鍵安裝:
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- 把Zsh設置為當前用戶的默認Shell:
$ chsh -s /bin/zsh
- 配置agnoster主題,vim ~/.zshrc,插入以下字段,source ~/.zshrc生效
ZSH_THEME="agnoster"
更改用戶名
如果是item2 + oh-my-zsh +
agnoster主題組合,cd到 ~/.oh-my-zsh/themes/
然后 vim agnoster.zsh-theme
,找到如下代碼
# Context: user@hostname (who am I and where am I) prompt_context() { if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then # 修改如下代碼,標灰色的地方可以自定義 # prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m" prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@Mac" fi }
iTerm2 快捷命令
命令 | 說明 |
---|---|
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 | 搜索命令歷史 |