screen のコピーモードで Emacsライクなキーバインド

.screenrc

# C-b 左, C-f 右, C-a 行頭, C-e 行末
# C-p 下, C-n 上, C-v 1ページ進む, M-v 1ページ戻る
# M-< バッファの先頭に移動, M-> バッファの最後に移動
markkeys h=^b:l=^f:0=^a:j=^n:k=^p:$=^e:^d=^v
bindkey -m ^[v stuff P
bindkey -m ^[< stuff g
bindkey -m ^[> stuff G

# 行末までコピーする(C-k)
bindkey -m ^k stuff ' $ '

# C-g コピーモード終了
bindkey -m ^g stuff !

# M-b, M-fで単語ごとに移動
bindkey -m ^[b stuff B
bindkey -m ^[f stuff E

#  コピー。 ctrl-space は動かないので諦めた
# bindkey -m ^' ' stuff ' '

# Xclip を使って、 X のクリップボードへ
# Space で選択開始、 M-w (または M-W) でコピー
bindkey -m ^[w eval 'msgwait 0' 'stuff \040' writebuf 'exec !!! xclip /tmp/screen-exchange' 'msgwait 1'
bindkey -m ^[W eval 'msgwait 0' 'stuff \040' writebuf 'exec !!! xclip /tmp/screen-exchange' 'msgwait 1'

2010-08-29 M-< と M-> を追加