• home
  • about
  • 全ての投稿
  • ソフトウェア・ハードウェアの設定のまとめ
  • 分析関連のまとめ
  • ヘルスケア関連のまとめ
  • 生涯学習関連のまとめ

iterm2

date: 2020-12-29 excerpt: iterm2の使い方とおすすめ設定

tag: macosxiterm2configurationterminal emulator


iterm2の使い方とおすすめ設定

概要

  • 事実上のMacOSXで動作するターミナルエミュレータのデファクトスタンダード
  • トラブルが発生したときのドキュメント量が多い

インストール

$ brew install iterm2

iterm2のおすすめ設定

設定の管理

  • PreferencesとProfileは別
    • Profile
      • json形式で管理され、フォント情報や背景情報等を管理している
    • Preferences
      • plist形式で管理されて、キーによる詳細な挙動等を定義できる

font

  • [Profile] -> [Text] -> [Font] -> (SF Mono, Light, 13 pointを選択)
  • 日本語のフォントをカスタマイズ
    • [Profile] -> [Text] -> [Use a different font for non-ASCII...を選択]
      • 好きなNon-ASCIIフォントを選択する

Appearance

  • タブをボトムに設置, トップのバーを表示しない(画面を広く使える)
    • [Appearance] -> [General] -> (Compact, Bottom, Bottomを選択)

設定のロード&セーブ

  • [General] -> [Preferences] -> [Load preferences from URL]を選択 -> gitのdotfileのcom.googlecode.iterm2.plistのrawを指定
  • Automaticallyを選択していると設定を変更すると保存先のファイルの内容も更新される

Optionの左側をMetaキーとして扱う

  • tmuxやzshでメタキーバインドを使う際に必須
  • [Profile] -> [Keys] -> [Gneral] -> (Left Option Keyで"Esc+"を選択)
  • 左のOptionをMetaに設定して、右のOptionをそのままにすればメタキーを二種類作り出すこともでき、不足しがちになModifier Keysを補える

タブの移動のショートカット

  • [Keys] -> [Key Bindings]
    1. Next Tab: ^]
    2. Previous Tab: ^[

タブの位置の移動

  • [Keys] -> [Key Bindings]
    1. Move Tab Right: ^⇧]
    2. Move Tab Left: ^⇧[

Two finger Swipeの無効化(MacBookで誤操作が多いため)

  • [Advanced] -> [Tabs] -> [Allow two-finger interactive...を無効化]

選択時にshift+カーソルで選択を移動しない(tmuxのキーバインドと衝突するから)

  • [General] -> [Selection] -> [Automatically enter copy mode...を無効化]

トラブルシューティング

zshで⌥ + Arrowが動作しない

  • 原因
    • デフォルトの設定で特殊なコードが送られるように設定されているから
  • 対応
    • [Pregerences] -> [Profiles] -> [Keys] -> [Key Mappings]から⌥ + Arrowを削除する


macosxiterm2configurationterminal emulator Share Tweet