LoginSignup
65
62

More than 5 years have passed since last update.

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

Posted at

tmuxバージョン1.8からcopy-pipeっていうコマンドが追加され、クリップボードに簡単にコピーできるようになったらしい。

セットアップ

tmuxとOS Xのクリップボードの橋渡しに必要。

$ brew install reattach-to-user-namespace

.tmux.confに以下を追記。

tmux.conf
# Use vim keybindings in copy mode
setw -g mode-keys vi

# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"

使い方

  1. <prefix [>でコピーモード開始
  2. vで選択
  3. yでクリップボードにコピー
  4. qでコピーモード終了

参照

GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS - tmux Copy & Paste on OS X: A Better Future

65
62
1

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
65
62