Copy between tmux sessions without including line numbers
clipboardtmuxvim
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:
Is there any way to avoid this?
Best Answer
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).
It depends on whether you are relying upon tmux to interpret the wheel-mouse, or not. If that's tmux — no, you cannot, because tmux would only see the wheel mouse events if it turned on the terminal's mouse operations.
Without turning on the mouse operations, some terminals may send up/down cursor keys to the application when it has switched to the alternate screen. VTE (gnome-terminal) has done that unconditionally for a few years. The same feature is an option(alternateScroll) in xterm. tmux switches to the alternate screen if the terminal description has that in the terminfo smcup and rmcup capabilities. While in the alternate screen, normally (except for this fairly recent up/down cursor feature), the wheel mouse would have no effect on the terminal.
So... you can get some limited use of the wheel mouse while running tmux, and it depends on the terminal and how it is configured.
Best Answer
tmux
has therectangle-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: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).