Hacker News new | past | comments | ask | show | jobs | submit login

You can configure tmux to synchronize with the X clipboard, although it is somewhat fiddly because of how terminal emulators work. See this page: https://github.com/tmux/tmux/wiki/Clipboard

In most terminal emulators you can also use Shift (or sometimes a different modifier) to bypass application mouse mode and have the terminal emulator handle the mouse event. Of course you can't copy out of the history with this, but that is another limitation of terminal emulators.




> that is another limitation of terminal emulators.

This seems more an excuse than a cause. When the "mouse mode" of tmux is off, the copy-paste mechanism works perfectly. There is no reason why this couldn't still be the case when the mouse mode is on. For example, tmux could enable the mouse only for scrolling and resizing the panes, while keeping the correct copy paste behavior intact. But it chooses not to.


No, this is not how it works. There is no terminal emulator that offers this kind of fine-grained mouse support. tmux can either turn the mouse on and handle everything (resize, scroll, copy and paste) itself, or it can leave it off and receive no mouse events.


Then it could react to a middle-click inside a pane by pasting the text of the clipboard.


tmux has no direct access to the X clipboard itself. Reading the clipboard with OSC 52 is possible but it is unfortunately not widely supported by terminal emulators (you can do it with `refresh-client -l` if the terminal emulator supports it).

Or you could read it with `xclip`, `xsel` or `pbpaste`, something like:

    bind -n MouseDown2Pane run "pbpaste|tmux loadb -" \; pasteb
From tmux 3.2, middle click will paste the top tmux paste buffer by default.


With mouse-mode on, try holding down shift to escape to regular behaviour.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: