I am running tmux inside urxvt. I would like to select and copy text using the left mouse button and paste it using the middle mouse button -- I am very old school.

I did get tmux-yank almost working but need to hit SHIFT+Mouse 1 Select doing the selection, then hit y… This is a lot of key presses.

Anyone knows how I can get this simple behaviour working better?

Here are some versions:

; tmux -V       
tmux 2.2
; urxvt256c-ml --version 
urxvt: "version": unknown or malformed option.
rxvt-unicode (urxvt256c-ml) v9.21 - released: 2014-12-31
options: perl,xft,styles,combining,blink,iso14755,unicode3,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,pixbuf,XIM,frills,selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm
; awesome --version
awesome v3.5.9 (Mighty Ravendark)
 • Build: Mar  7 2016 18:43:56 for x86_64 by gcc version 6.0.0 (mockbuild@)
 • Compiled against Lua 5.3.2 (running with Lua 5.3)
 • D-Bus support: ✔
  • 1
    Old school is actually: select with left button and paste with middle button (and it works out-of-the-box). Did I understand correctly? You want to copy with middle button, not paste? – Martin Sugioarto Sep 23 '16 at 11:45
  • @MartinSugioarto: Oops, you are right. Select and copy with left, paste with middle. And that does not work out of the box… – Sardathrion Sep 23 '16 at 11:51
  • @MartinSugioarto: Well, ${insult}! It does indeed work out of the box. Something is FUBAR with my configuration, somewhere: set -g mouse on seems to be it. – Sardathrion Sep 23 '16 at 11:53

In case some other poor soul struggles with this, here is my ~/.tmux.conf file. I use the tmux plugin manager so install that first.

# ./tmux.conf

# Powerline…
run-shell "powerline-daemon -q"
source '~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'

# VI-mode…
setw -g mode-keys vi

# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window

# Set windows modes styles
set -g mode-style "fg=black,bg=colour69"

# Renumber windows
set -g renumber-windows on

# Automaitcally rename.
setw -g automatic-rename

# Allows for faster key repetition
set -s escape-time 0

# Scroll History
set -g history-limit 30000

# Mouse
set -g mouse on # ← This stops the default correct behaviour…

# List of plugins
set -g @plugin 'tmux-plugins/tpm' # ← The tmux plugin manager.
set -g @plugin 'nhdaly/tmux-scroll-copy-mode' # ← sane scrolling.
set -g @plugin 'tmux-plugins/tmux-yank' # ← Yanking.
set -g @shell_mode 'vi'  # tmux-yank option.
set -g @yank_selection 'primary'  # tmux-yank option.

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

So, you can use the mouse to select whatever text you wish. If you hit y before releasing the left mouse button, the selection is copy into the primary buffer which you can paste via the middle mouse click.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.