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

I use tmux (window tabs, vertical or horizontal pane splits) and opt-in tiling shortcuts for the desktop to quickly move apps to corner, top, bottom etc. Works for me.



I used tmux before Terminator for my local usage, but the fact that a mouse selection covers all panes at once makes it really annoying.

Tmux is great for remote/shared usage though (and it survives ssh disconnection).


Can't tmux's built-in mouse support¹ handle this? Just add

  set -g option mouse on
to your `tmux.conf` and tmux will do mouse selections for you and won't cross pane boundaries.

You can use something like tmux-yank² to get your tmux selections onto your OS/DE clipboard if you're not using a nice/modern terminal emulator with OSC 52 support and you don't want to manually plug in `xsel` or `pbcopy` or whatever. (See the tmux docs on clipboard integration³ if you're not sure whether/how your terminal supports the standard.)

--

1: https://www.man7.org/linux/man-pages/man1/tmux.1.html#MOUSE_...

2: https://github.com/tmux-plugins/tmux-yank

3: https://github.com/tmux/tmux/wiki/Clipboard


Yes it can! It's hard to get precisely the behaviour you want across tmux and vim. I'm 99% there with my config. Selecting any text copies it to the clipboard (with options that work for Xorg or Wayland) and handling panels properly.

The only remaining annoyance for me, and one which I don't think is "fixable"... say your left pane is a terminal and you've got a few pages of output (cat something). The right pane has a file open on vim, where you're making notes. As you scroll through the long output you want to select a chunk of text and then paste it into vim, and then carry on scrolling as you hunt for the next clue. Except that the instant you select text, focus returns to the prompt at the bottom of the pane. You compete lose your scroll position. It's intensely annoying. The workaround is "don't do it that way", which is fine until you forget and end up shouting at your computer.


Does that reset/jump still happen when you're in copy-mode?

If not, maybe you can you rebind the scroll wheel to enter copy-mode if it's not already in it, and then scroll, and bind enter/return while in copy-mode to exit copy-mode.


Oddly enough I searched for a fix for this after posting. And amazingly I found one that works (as well as several that didn't, and one that require add-ons)

For anyone interested, this is in my .tmux.conf now

    unbind -T copy-mode-vi Enter
    bind-key -T copy-mode-vi Enter send -X copy-pipe "xclip -selection c -i" \; send -X clear-selection
    bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe "xclip -selection c -i" \; send -X clear-selection

You would have to switch the xclip for wl-copy if you're using Wayland, and some form of pbcopy command on Mac. No idea what windows folks do.




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

Search: