iterm2使用

iterm2使用

iterm2文檔html

終端中輸入命令時,移動光標有兩種方式,一個是 emacs,一個 vi,能夠經過 set 命令來設置,默認的是 emacs 模式,也能夠經過set -o emacs來顯式設置。若是想使用 vi 模式,可使用以下命令set -o vi開啓。
開啓vi 模式後,默認是 insert 模式,按下esc鍵進入命令模式。python

vi模式

h Move cursor left
l Move cursor right
A Move cursor to end of line and put in insert mode
0 (zero) Move cursor to beginning of line (doesn't put in insert mode)
i Put into insert mode at current position
a Put into insert mode after current position
dd Delete line (saved for pasting)
D Delete text after current cursor position (saved for pasting)
p Paste text that was deleted
j Move up through history commands
k Move down through history commands
u Undo
ctrl + r 搜索歷史命令
!! 執行上條命令
ctrl+X Ctrl+E 調用默認編輯器去編輯一個特別長的命令git

oh-my-zsh

oh-my-zsh文檔github

安裝

$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

字體

powerline

powerline文檔bash

安裝

$ sudo easy_install pip
$ pip install powerline-status
# 安裝字體
$ git clone https://github.com/powerline/fonts.git
$ cd到install.sh文件所在目錄
$ ./install.sh

配置

安裝完字體庫以後,把iTerm 2的設置裏的Profile中的Text 選項卡中裏的Regular Font和Non-ASCII Font的字體都設置成 Powerline的字體curl

主題

agnoster

agnoster文檔編輯器

下載agnoster

# 1. 下載
$ git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git
# 2. 到下載的工程裏面運行install文件,主題將安裝到~/.oh-my-zsh/themes目錄下

設置主題

$ 打開 ~/.zshrc
# .zshrc文件下面添加ZSH_THEME="agnoster"

插件

Oh My Zsh 自己自帶了不少插件,好比說: git, autojump osx, 不過基本都沒有啓用,插件目錄: ~/.oh-my-zsh/plugins字體

增長指令高亮效果——zsh-syntax-highlighting

參考ui

z

強大的目錄自動跳轉命令,會記憶你曾經進入過的目錄,用模糊匹配快速進入你想要的目錄。url

git

當你處於一個git受控的目錄下時,Shell會明確顯示git和branch,另外對git不少命令進行了簡化,例如gco=’git checkout’、gd=’git diff’、gst=’git status’、g=’git’等等,熟練使用能夠大大減小 git 的命令長度,命令內容能夠參考~/.oh-my-zsh/plugins/git/git.plugin.zsh。

extract

功能強大的解壓插件,全部類型的文件解壓一個命令x全搞定,不再須要去記tar後面究竟是哪幾個參數了。

osx

tab加強,quick-look filename能夠直接預覽文件,man-preview grep能夠生成grep手冊的pdf版本等。

sublime

st          # 直接打開sublime
st file_a   # 用sublime打開文件 file
st dir_a    # 用sublime打開目錄 dir
stt         # 在sublime打開當前目錄,至關於 st .

autojump

已經在.oh-my-zsh中包含,若是沒有能夠按照下面的進行安裝

# 安裝
$ brew install autojump
# 使用
$ j 跳轉到最多訪問的目錄

問題

若是autojump 或者j 使用有問題,請嘗試在~/.zshrc(使用默認bash配置文件)中添加[[ -s brew --prefix/etc/autojump.zsh ]] && . brew --prefix/etc/autojump.zsh

啓用插件

# ~/.zshrc配置
# 啓用插件 git, autojump, osx和autojump
plugins=(git osx sudo python autojump)

配色方案

solarized

solarized文檔

安裝

# 1. 首先下載solarized配色方案
$ git clone git://github.com/altercation/solarized.git
# 2. 雙擊執行solarized/iterm2-colors-solarized/Solarized Dark.itermcolors
# (或者Solarized Light.itermcolors ps: 我的覺着dark仍是不錯的)
# 3. iTerm2 - Preferences - Profiles - colors - load presets 選擇剛剛安裝的配色主題

配置

iTerm2 - Preferences - Profiles - Text - Text Rendering, 將 Draw bold text in bright colors 前面的勾去掉

快捷鍵呼出

Preferences - Keys - Hotkey - Hotkey toggles a dedicated window with profile
把它設置成 Hotkey Window,按快捷鍵以後 Hotkey Window 會從屏幕上面摺疊下來

配置

  • Preferences - Profiles - Terminal - Terminal Emulation - Report Terminal Type

將其中的 xterm 改爲 xterm-256color,好比在 Vim 顯示一些配色方案會好不少

  • ⌘+Q關閉iTerm 2 時每次彈窗提示問題: iTerm 2 中,進入Preference-General-Closing欄目,將Confirm "Quit iTerm2(⌘Q)" command選項勾選去掉就行
  • 啓動iTerm 2 默認使用bash改用zsh解決方法: chsh -s /bin/zsh
  • 啓用命令糾錯功能: ENABLE_CORRECTION="true"

iterm快捷鍵

open . 在當前目錄下打開finder
⌘ + return 全屏
⌘ + f 所查找的內容會被自動複製
⌘ + d 橫着分屏 / ⌘ + shift + d 豎着分屏令
⌘ + / 光標位置
⌘ + r 只是換到新一屏,不會像 clear 同樣建立一個空屏
ctrl + u 清除當前行
ctrl + a 到行首
ctrl + e 到行尾
ctrl + w 刪除光標以前的單詞
ctrl + k 刪除到文本末尾
⌘ + alt + 方向鍵 切換屏幕(用於hotkey window)
⌘ + 方向鍵 切換tab
ctrl + _ Undo
ctrl + y Paste the last thing to be cut
相關文章
相關標籤/搜索