Getting back old copy paste behaviour in tmux, with mouse
- Copy the text: select the text and press mouse
left-button
withshift
key press too. - Paste the text with
shift
key +middle-button
To restore the default copy/paste configuration you need to (at least temporarily) turn off mouse support within tmux:
prefix : set -g mouse off
Where prefix
is the tmux access key (Ctrl+B by default unless you re-map it). : starts command mode and set -g
sets the parameter globally.
When mouse mode is turned off, the standard copy/paste functions provided by your operating system work as expected.
Something else you might want to do is 'maximise' the current pane, so you can copy multiple lines easily.
If you’re working with an old (pre-2.1) version of tmux, you instead need to use the following:
prefix : set -g mode-mouse off
There are more details and some handy key bindings to automate all this here:
http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
The main thrust of the article linked to above is this excerpt from .tmux.conf:
# disable mouse control by default - change 'off' to 'on' to enable by default.
setw -g mode-mouse off
set-option -g mouse-resize-pane off
set-option -g mouse-select-pane off
set-option -g mouse-select-window off
# toggle mouse mode to allow mouse copy/paste
# set mouse on with prefix m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# set mouse off with prefix M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
# zoom this pane to full screen
bind + \
new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\
swap-pane -s tmux-zoom.0 \;\
select-window -t tmux-zoom
# restore this pane
bind - \
last-window \;\
swap-pane -s tmux-zoom.0 \;\
kill-window -t tmux-zoom
If "set -g mode-mouse on" you can do this trick:
On Mac, press "fn" button, then select text and copy with mouse right click or keyboard cmd+c.