1

I'm using tmux with the following lines in my .tmux.def:

bind p paste-buffer
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

It works well and I can start copy mode by pressing "v", copy with "y" and paste with "prefix, p" afterwards. However, the thing I really miss from vim is "V", which lets you select entire lines. Much easier than press 0, then v, then $.

Does anyone know how to implement "V" in the same style as above? Bonus points for block select, "C-v".

1 Answer 1

1

Put this in your tmux configuration.

bind V send-keys "0v\$"

This is kind of hacky and it just helps you select entire line easier. In copy mode, you can simply press your prefix key then press V, to select the entire line.

For the visual block select, add this to your tmux configuration.

bind -t vi-copy V rectangle-toggle

In copy mode, when you have selected the whole line, use V to toggle rectangle select in tmux a.k.a. visual block mode in Vim.

Here is the screencast to demonstrate the settings.

2
  • Would be nice if by pressing <prefix>V it would continue selecting entire lines when moving up/down, like in Vim. But this shortcut at least saves me from having to press 0,v,$ for the first line, and the second bind works great. Thanks for your answer!
    – danns87
    Apr 29, 2014 at 21:17
  • @danns87 That's weird, mine is still selecting entire lines when I moving up/down key. Here is my .tmux.conf, maybe you have to look at line 44. github.com/attomos/dotfiles/blob/master/tmux.conf#L44
    – attomos
    Apr 30, 2014 at 1:58

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.