LoginSignup
7
7

More than 5 years have passed since last update.

GNU screen のコピー機能と、クリップボードの同期

Last updated at Posted at 2012-07-03

.zshrc とか .bashrc にこう書く

if which xsel > /dev/null 2>&1
then
    # X Window System 環境でのコピー (xsel をインストールする必要あり)
    copy_cmd="xsel -i -b < /tmp/screen-exchange;\
              xsel -i -p < /tmp/screen-exchange"
elif which pbcopy > /dev/null 2>&1
then
    # Mac OS X 環境でのコピー (要動作テスト)
    copy_cmd="pbcopy < /tmp/screen-exchange"
elif which putclip > /dev/null 2>&1
then
    # Cygwin 環境でのコピー(要動作テスト)
    copy_cmd="putclip < /tmp/screen-exchange"
fi
[ $STY ] && [ $copy_cmd ] &&\
  screen -X bindkey -m ' ' eval "stuff ' '" writebuf "exec sh -c '$copy_cmd'"

bash では動作テストしてないけど多分動く。

screen でシェル立ち上げるたびにキーバインド設定されてしまうの気持ち悪いのでどうにかしたい。

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7