problem at hand: how do i use the mouse to copy/paste text in xterm running tmux on PC?
normally you should not have problems selecting text and pasting it with your mouse. everybody knows about left clicking and then dragging to select and copy the text. in order to paste you need to middle click your mouse. however there are certain options which if set will prevent this functionality.
if you have set the following options
- mouse-select-pane
- mouse-select-window
you will notice that you are not able to select text at all.
the solution is to use the shift key.
hold down the shift key and then left click and drag across the target text. if you want to now paste the selected text back in to xterm, you must also hold down the shift key and then middle click in order to paste the text.
this is not mentioned in the tmux man pages so i do not think this is a tmux feature. guess this has something to do with xterm, but i m not sure.
xterm version 278-1
tmux version 1.6-2
archlinux
PC
guly in the comments informs me that iterm users on macosx need to use the option key.
bruceedge pointed out that if the target text area resides in a pane of a split window then trying to copy with this method will also copy stuff from adjacent panes.
to counter this problem one hack is to use the zoom pane functionality. say you want select text from a pane that resides in a split window with other panes. with keyboard focus on the target pane, you simply hit prefix + z to maximize this pane to the entire window. copy what ever it is you want to copy and then hit prefix + z again to toggle back to the previous state.
Thanks a lot for sharing this!
thank you
Thank you!
This also works in “Gnome Terminal” and “rxvt-unicode/urxvt”.
thanks for the info
Yes, you’re right! Without holding the Shift key would make tmux handle our mouse click and select events as if we were selecting it using keyboard (after a prefix-[ ). Holding it would directly send those events to the terminal emulator.
thank you for the comment
. yeah i m not too sure if this is xterm specific
Thanks a lot! I was about to throw my computer out of the window yesterday
I wanted to add that I’m using rxvt-unicode and zsh and had the same issue
thank you
thanks works with tilda
thanks for your like and comment
thank you
thank you too
Very helpful… Thank you very much.
thank u too
Thanks!
thank u too
on iTerm/macosx you need to use option key, shift doesn’t work
thanks for the info
My office mates have asked me to thank you.
Apparently, they were getting tired of my cursing… (no windows in this office).
For reference: Linux+KDE, konsole 2.9.5 -> ssh -> tmux 1.7 here, and bash everywhere.
TMux options: mode-mouse=copy-mode, mouse-select-window=on .
ha ha
they are welcome! thanks for the funny comment
Thank you!
you are welcome and thanks for the comment
What I love about this “solution” is that it is simple. I was going to play with key bindings after looking at other blogs, etc. You saved me though! Cannot beat simplicity.
Thanks!
An Archer
Many thanks! Just paying it forward and doing my duty in my limited capacity
. thanks.
Thank you soo much!!! I learned something useful today!
you are welcome. thanks for leaving a nice comment
thanks for the tip! not being able to select text with a mouse when usign tmux has been bugging me for ages – great work for taking the time to post this.
thanks mate!
Hey, thank you very much for the tip.
.
I’m quite new to tmux, but given good tips like yours, I almost have everything I need in my simple config
you are welcome mate
This works fine when you have a single column in a window, but once you split your terminal into multiple columns, the text selection spans both columns, which is never going to be what you want.
indeed you are right. thanks for pointing that out to me. i never ran in to that situation. however i can pass on a dirty hack to get around this problem.
in tmux version 1.8 one can zoom in on the pane and then unzoom using the prefix + z key chord.
so if you want to copy stuff off of a pane simply hit your prefix key (Ctrl-b) and then hit z.
this will maximize this pane. now copy your stuff and hit Ctrl-b z again.
hope that helps and thanks for the comment