EDIT: After checking the source code, I've re-written my answer completely.
I originally thought this wasn't possible because I couldn't get this to work, but the other answers are correct about v
being the correct key for this, but it's not obvious how to use this, especially if you are used to vim.
Also, it wouldn't work for me because I had v
bound to begin-selection
- I think I must have blindly copied this idea from somewhere else to mimic the vim way to start a character wise selection, not knowing it would cause problems further down the road with block selections.
$ tmux -V
tmux 1.9a
$ tmux list-keys -t vi-copy | grep " v "
bind-key -t vi-copy v begin-selection # suppressed my block selection mode
Once I took away this binding (by commenting out the line in my .tmux.conf
and restarting tmux), it started to work, but it's still rather confusing because it's not the same as vim at all.
With default bindings, it should work as follows:
- Make sure you have tmux unning with
setw -g mode-keys vi
in your .tmux.conf
.
- type
C-a [
to start copy mode
- move the cursor to where you want to begin the selection
- type
v
- type
Space
to start the selection
- move the cursor and you will see a rectangular selection
- you can press
v
again to toggle the selection back into character-wise selection or vice-versa.
You don't have to type the v
before you press Space
. You could start the the character-wise selection with Space
first and press v
afterwards to toggle to rectangular selection mode.
It's quite different from vim in that in tmux you have to type two characters: Space
and v
to get into rectangular selection mode. In vim you only have to type Ctrl-V
.
Also in vim v
starts a character-wise selection, not block.
Sadly, there doesn't seem to be a line-wise selection mode in tmux (Shift-v
in vim).
EDIT: It looks like Tmux version 2.0 provides a line-wise selection mode with Shift-v
(I haven't tried it yet though!)
Nope, still no solution. – Srećko Toroman – 2015-07-14T18:37:41.820
Actually, there is a solution. – Srećko Toroman – 2015-07-14T18:41:38.287
bind-key -t vi-copy 'C-v' rectangle-toggle – Srećko Toroman – 2015-07-14T18:41:41.953
How do you activate Vi keybindings in tmux? – romainl – 2012-02-29T06:40:37.387
add "set-window-option -g mode-keys vi" to your ~/.tmux.conf – Srećko Toroman – 2013-04-29T20:45:58.967
1It looks like the answers aren't getting to your question of using visual block mode - "multiple lines, but not full width" is also what I'm looking for. Did you find your own solution? – dmonopoly – 2014-04-23T14:38:50.620