In basic iterm2, multi-select is simple, just hold command key and drag-and-drop or double click will do the trick. We will have some discrete highlight text, something like this:
i.e. I can have "At work" & "inversel" highlight at the same time.
But this does not work in tmux session with iterm2, hold command key and drag-and-drop will not select anything or highlight.
Thanks for any suggestions.
EDIT: A million thanks to @Simba for the detailed explanation. But I can't find the "mouse report" switch, is this about the item2 version or I miss something?
EDIT2: @Simba I found the box (Session -> Edit Session -> Terminal -> Enable mouse reporting), but uncheck it's not working, even after I restart itemr2 it's checked again everytime LOL
EDIT3: After several times restart now it's working, I have no idea what's happening... Thanks! @Simba
"hold command key and drag-and-drop" to do multiple copy is a feature of iTerm2, the terminal. Within tmux, the copy action is handled by tmux, and tmux doesn't support this multi-copy feature.
An alternative way: use tmux integration mode of iTerm2 by starting a tmux session with tmux -CC
.
After this, the drag action is detected by iTerm2 directly. You can copy the content in iTerm2 by holding "Command" just as when tmux is not used.
Cmd + Drag is bound to continuous selection in iTerm2. Since "mouse reporting" is intercepted by tmux, to use this feature (continuous selection), you need to disable "mouse reporting" temporarily.
Drawback: To use continuous selection, "Mouse reporting" must be disabled. But once "mouse reporting" is disabled, you can't scroll to previous or next page. That means you can do continuous selection in current page.
Quote from iTerm2 FAQ
Q: What modifier keys affect marking a selection for copy and paste? A: If you hold down modifier keys while making a selection, the behavior changes in various ways:
- Alt/Option: Mouse reporting will be disabled. If you're using vim and you can't make a selection, try holding down the alt key and see if that fixes it.
- Alt + Cmd: Make a rectangular selection.
- Shift: Extend an existing selection.
- Alt + Shift: Extend a rectangular selection.
- Cmd: Make a discontinuous selection
Unfortunately, selection modifier key Alt + Cmd is bound to " rectangular selection" and it doesn't seem to be customizable. But you can bind a shortcut to toggle "mouse reporting".