DEV Community

Discussion on: The Easy Way to Copy Text in Tmux

Collapse
 
pbnj profile image
Peter Benjamin (they/them)

I have not experienced any problems selecting and copying text in tmux with a mouse after setting set -g mouse on.

If you want to emulate some terminal features like "auto copy selected text", you can set the additional tmux setting:

bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "<clipboard_program>"
Enter fullscreen mode Exit fullscreen mode

Where <clipboard_program> on linux can be something like xclip and on mac would be pbcopy.

From this point on, you can use the mouse to click-and-drag selection over text and once you let go, tmux will automatically copy to system clipboard.