I am learning to use tmux, I found when I in a tmux window, double-click to select and copy function did not work any more.
Can I use double-click to select and copy just as in iterm2?
I have googled for some time, but did not find an short and clear answer to this. I have added setw -g mode-mouse on
in the tmux configure file already.
Use the 'Ctrl+spacebar' to start copying. Step 3. Move with the arrow keys to the position of the text you want to copy to. When you have finished selecting the text, press 'Alt+w' or 'Ctrl+w' to copy the text to a Tmux Buffer.
tmux's copy mode In tmux Ctrl + b [ enters copy mode, where you can move the cursor around and select text. If you have tmux's mouse mode enabled ( set -g mouse on ) then scrolling with the scrollwheel also enters copy mode. Ctrl + b Page Up enters copy mode and scrolls up by one page.
I found a way to achieve that: hold the option
key when double clicking.
Don't know about iterm2, but this can be made to work in tmux 3.0 or newer
(tested on Linux w/ tmux 3.0, last command uses X11 xclip).
Added triple click to select and copy a line too.
# Double LMB Select & Copy (Word) bind-key -T copy-mode-vi DoubleClick1Pane \ select-pane \; \ send-keys -X select-word-no-clear \; \ send-keys -X copy-pipe-no-clear "xclip -in -sel primary" bind-key -n DoubleClick1Pane \ select-pane \; \ copy-mode -M \; \ send-keys -X select-word \; \ send-keys -X copy-pipe-no-clear "xclip -in -sel primary" # Triple LMB Select & Copy (Line) bind-key -T copy-mode-vi TripleClick1Pane \ select-pane \; \ send-keys -X select-line \; \ send-keys -X copy-pipe-no-clear "xclip -in -sel primary" bind-key -n TripleClick1Pane \ select-pane \; \ copy-mode -M \; \ send-keys -X select-line \; \ send-keys -X copy-pipe-no-clear "xclip -in -sel primary"
If you don't use copy-mode-vi
, replace this with copy-mode
.
For older tmux versions check the edit-history.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With