Make sure to check the bottom of this post for necessary bindings that need to go into your .tmux.conf file.
I am assuming your prefix key is C-a:
- C-a means: press Ctrl + A
- C-a [ means: press Ctrl + A then press [
To do a rectangle selection of text from (1,1) to (2,2) in tmux:
- Go to the copy mode: C-a [
- Move the middle of a line
- Press C-v
- Press Space
- Move the selection with jkhl
- Once you are happy with your selection press Enter (or y if you have
the binding in your conf file).
- You can paste the latest copy buffer by: C-a ]
Notice that pressing space is necessary for rectangle selection.
To select lines like you would normally do, go the copy mode, and press v, select with jkhl keys and press y.
I have these bindings in my .tmux.conf:
Prior to version 2.4 (20 April 2017):
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection # Begin selection in copy mode.
bind-key -t vi-copy 'C-v' rectangle-toggle # Begin selection in copy mode.
bind-key -t vi-copy 'y' copy-selection # Yank selection in copy mode.
After version 2.4:
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode.
bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode.
It is important to unbind default rectangle-toggle binding:
unbind-key -t vi-copy v # Prior to version 2.4
unbind-key -T copy-mode-vi v
Otherwise new 'C-v' binding doesn't work.
Note: to have a single .tmux.conf
which works across versions, see this question.
due to a limitation in the protocol, it is not possible for terminal applications to only request the scrolling but not the selection. It's an all or nothing. So even if tmux wanted, it has no way of doing what you desire.
You have the following options:
- set up a keyboard short-cut that copies the tmux selection into your system clipboard
- use a terminal that supports set-clipboard function, such as xterm
- disable any use of the mouse in tmux
unfortunately, answer to your question is No
Best Answer
Short answer: space starts selection and enter copies.
For future reference, I got this from the tmux man page:
Update: The
tmux list-keys
command will also list any custom key bindings you have.