12
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

tmuxからクリップボードにコピーする

Last updated at Posted at 2017-04-04

#環境
Ubuntu 16.04.2 LTS
tmux 2.1
xsel version 1.2.0

※現行バージョンのtmuxはバージョンが2.9となります。この記事の情報は古いです。
※※令和版を書きました。→https://qiita.com/purutane/items/1d1dc4818013bbbaead4

#設定箇所
下記を~/.tmux.confに追記しました。

~/.tmux.conf
set-window-option -g mode-keys vi

-bind-key -t vi-copy v begin-selection
-bind-key -t vi-copy C-v rectangle-toggle
-bind-key -t vi-copy y copy-pipe "xsel -bi"
-bind-key -t vi-copy Enter copy-pipe "xsel -bi"

※もともと"v"にはrectangle-toggleがバインドされているために、"C-v"にバインドを移動させています。

#使い方

  1. "<prefix> ["でコピーモードに入る
  2. "v"で選択を開始
  3. "y"もしくは"Enter"で選択を終了(コピー)、その結果がxselにパイプされクリップボードにコピー
  4. ハッピー
12
6
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
12
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?