screen のウィンドウ操作を Emacs ライクに

prefix キーを例えば C-z に割り当てているとすると、 C-z C-x 2 でウィンドウを上下に分割する。
C-z C-x o で他のウィンドウに移動できるけど、やってみると以外と面倒。他のウィンドウへの移動は C-z o でもできるようにしておく。

.screenrc

bind ^x command -c CTRL_X

## ウィンドウ操作
# c or C-x C-f  screen          新しいウィンドウを開始する
bind -c CTRL_X ^f screen

# A or C-x C-w  title           タイトル変更
bind -c CTRL_X ^w title

# d or C-x C-c  detach          デタッチ
bind -c CTRL_X ^c detach

# z             suspend         サスペンド。fgで再開

# K or C-x k    kill            ウィンドウ破棄
bind -c CTRL_X k  kill

## ウィンドウ分割
# S or C-x 2    split           現在のウィンドウ 2 分割
bind -c CTRL_X 2 eval split focus

# C-x 3         split           現在のウィンドウ縦分割(未確認)
bind -c CTRL_X 3 "split -v" focus

# TAB or C-x o or "o"   focus   移動
bind -c CTRL_X o focus
bind o focus

# Q or C-x 1    only            現在の領域以外を破棄
bind -c CTRL_X 1 only

# X or C-x 0    remove          現在の領域を破棄
bind -c CTRL_X 0 remove

#               resize          リサイズ
# http://www.rubyist.net/~rubikitch/computer/screen/
# PrefixKey rでwindowの大きさ変更モード。+でreseize + 1, -でresize -1
# Escapeでモード抜ける
bind r eval 'echo "Resize window"' 'command -c resize'
bind -c resize ^]  command
bind -c resize + eval 'resize +1' 'command -c resize'
bind -c resize - eval 'resize -1' 'command -c resize'