公式サイト(https://www.iterm2.com/) からダウンロード
$ brew cask install iterm2
Preferences →Profilesタブ →Sessionタブ
“Automatically log session input to files in:“にチェック
ディレクトリの絶対パスを入力する(例/Users/takaaki/Desktop/terminallogs)
間違えてタブを閉じたときに、「Cmd + z」で一定時間内なら再度開くことができます。
Preferences > Profiles > Settion で、Undoできるまでのタイムリミットを変更できます。
例:500 ミリ = 5 秒
iTerm2は、マウスでもできますが、もちろんショートカットも使えます。
| Command + t | 新しいタブを作成 |
| Command + T | タブを複製する |
| Command + w | タブを削除する |
| Command + 矢印キー | タブを移動する |
| Command + D | ウインドウを左右に分割する |
| Command + Shift + D | ウインドウを上下に分割する |
| Command + n | 新しいウインドウを作成 |
| Command + Enter | 全画面を表示させる |
| Command + [ | 次のウインドウへ移動 |
| Command + ] | 前のウインドウへ移動 |
| Command + f | 検索 |
$ vi ~/.zshrc
# 環境変数
export LANG=ja_JP.UTF-8
# ヒストリの設定
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=1000000
# share .zshhistory
setopt inc_append_history
setopt share_history
# 直前のコマンドの重複を削除
setopt hist_ignore_dups
# 同じコマンドをヒストリに残さない
setopt hist_ignore_all_dups
# 同時に起動したzshの間でヒストリを共有
setopt share_history
# 補完機能を有効にする
autoload -Uz compinit
compinit -u
if [ -e /usr/local/share/zsh-completions ]; then
fpath=(/usr/local/share/zsh-completions $fpath)
fi
# 補完で小文字でも大文字にマッチさせる
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# 補完候補を詰めて表示
setopt list_packed
# 補完候補一覧をカラー表示
autoload colors
zstyle ':completion:*' list-colors ''
# コマンドのスペルを訂正
setopt correct
# ビープ音を鳴らさない
setopt no_beep
# ディレクトリスタック
DIRSTACKSIZE=100
setopt AUTO_PUSHD
# git
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "%F{magenta}!"
zstyle ':vcs_info:git:*' unstagedstr "%F{yellow}+"
zstyle ':vcs_info:*' formats "%F{cyan}%c%u[%b]%f"
zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd () { vcs_info }
# プロンプトカスタマイズ
PROMPT='
[%B%F{red}%n@%m%f%b:%F{green}%~%f]%F{cyan}$vcs_info_msg_0_%f
%F{yellow}$%f '
#export PS1="%N %~ %# "
#export PS1="%n %~ %# "
$ source ~/.zshrc
Host * StrictHostKeyChecking no UserKnownHostsFile=/dev/null ServerAliveInterval 15 ServerAliveCountMax 30 AddKeysToAgent yes UseKeychain yes IdentitiesOnly yes KexAlgorithms +diffie-hellman-group1-sha1 Ciphers aes128-cbc
StrictHostKeyChecking no ホストキーチェック回避
UserKnownHostsFile=/dev/null ホストキーチェック回避
ServerAliveInterval 15 タイムアウト対策
ServerAliveCountMax 30 タイムアウト対策
AddKeysToAgent yes 毎回パスフレーズを聞かれてくることに対する対策
UseKeychain yes 毎回パスフレーズを聞かれてくることに対する対策
LogLevel QUIET 警告メッセージを非表示にする
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts. このメッセージ。
KexAlgorithms +diffie-hellman-group1-sha1 「no matching key exchange method found. Their offer: diffie-hellman-group1-sha1 」の対策
Ciphers aes128-cbc 「no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc」の対策