tmux でコマンドライン履歴のスクロールバックとコピペ

[`evernote` not found]
Bookmark this on Hatena Bookmark
Share on Facebook
LINEで送る

tmux使用中にShift+PageUpしても画面がスクロールしていってしまって,tmuxの中の履歴を参照できず困っていた.
これは,tmuxのコピーモードを使えば解消するらしい.

実は,tmux の部分は全部 man tmux に載ってる.

プレフィックス(デフォルトでC-b)をPrefixと表記する.

キーバインド(viモードの場合)

key binding explanation
Prefix+[ コピーモード開始
q コピーモード終了
Space Start selection
Enter Copy selection
Prefix+] Paste the most recently copied buffer of text

X Window system clipboardとの連携

$ sudo apt-get install xsel
bind-key > save-buffer ~/.tmux-buffer \; run-shell 'xsel -b -i < ~/.tmux-buffer' \; display-message "Copied to clipboard"
bind-key < if-shell 'xsel -b -o > ~/.tmux-buffer' 'load-buffer ~/.tmux-buffer ; paste-buffer'