I'm using tmux with vi keys, and copy/paste works fine as long as you're selecting one line of text, or if you have only one window. When I want to select a block of text (multiple lines, but not full width), then I run into trouble. If I have multiple vim windows opened, then it would select text from all of them, and what I need is to select text only from one window. That is, just like a visual select in vim.
Is this possible to do?
Best Answer
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:
To do a rectangle selection of text from (1,1) to (2,2) in tmux:
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):
After version 2.4:
It is important to unbind default rectangle-toggle binding:
Otherwise new 'C-v' binding doesn't work.
Note: to have a single
.tmux.conf
which works across versions, see this question.