When I try to copy and paste between tmux sessions or windows, one problem is that I usually have line numbers displayed when using Vim and tmux copies the line numbers:enter image description here

Is there any way to avoid this?

  • set nonu, or "+y...
    – jasonwryan
    Dec 20, 2017 at 23:39
  • or with more complication see what vim-tmux-navigator does; there may be a way to have tmux save-bufer - | somethingthatstripsthenumbers set when in vim under tmux (though that may require routing through the os clipboard, or a corresponding tmux set-buffer ...)
    – thrig
    Dec 21, 2017 at 0:20

1 Answer 1


tmux has the rectangle-toggle command for this. It's not fully explained in the man page; it only appears in the list of commands available during copy mode:

Command             vi      emacs
rectangle-toggle    v       R

It switches between the line-based selection you demonstrate, and rectangular selection (similar to Vim's blockwise visual mode). In the latter mode, you can start your selection at static and extend down+right without taking in anything to the left (the line numbers).

  • I can only seem to make this work with Emacs mod. When I do C-b then :set-window-option -g mode-keys vi then try the C-b [ then v to C-space, it doesn't seem to work.
    – FilBot3
    Nov 25, 2020 at 16:40
  • @FilBot3 It works for me (tmux 3.1c). In vi mode the begin-selection binding is space rather than C-space, does that help?
    – JigglyNaga
    Nov 26, 2020 at 19:14

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.