Live data from Hacker News

Tmux for Mere Mortals

zserge.com

61–70 of 171 posts

Re: Tmux for Mere Mortals

#61

Earlier quoted context omitted.

> 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.

Re: Tmux for Mere Mortals

#62

Earlier quoted context omitted.

Yes, the mouse situation in tmux is catastrophic. As much as I love tmux, I wonder what would it take that the program respects the usual copy-paste conventions like all the rest of X programs. You need to do two things, that are apparently impossible when tmux has "mouse enabled": 1. select some text in your xterm so that it gets copied 2. middle click on the xterm and your copied text (possibly from other window, w…

It works just like that if you press shift?

> It works just like that if you press shift?

My point exactly. I want to do that without pressing shift.

Re: Tmux for Mere Mortals

#63
Nice to see somebody else go through the exact same thought processes I did - there's no need for tiling when everything other than the terminal is fullscreened on its own workspace. 2D workspace grids are crucial to this flow though, which is sadly something that seems to be slowly being removed from most desktop environments. I can recommend https://extensions.gnome.org/extension/1485/workspace-matrix... for Gnome.

My tmux bindings are also different, but the logic behind them is the same. Mine are available here - https://github.com/tom-james-watson/dotfiles

Re: Tmux for Mere Mortals

#64

Earlier quoted context omitted.

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.

Re: Tmux for Mere Mortals

#65
post #4

What this author has settled on looks very similar to commonly used tiling window manager shortcuts (which should not be very surprising, because a lot of the constraints desired by the author apply to the other situation also). In fact, even more directly, the author is basically using TMUX as a the tiling window manager for their terminals. So, I guess the funny thing is, this gives a nice bunch of Tmux shortcuts,…

Yes, and there are a number of other configurations doing the same. This is another recent one https://github.com/jabirali/tmux-tilish that works as a tmux plugin.

Re: Tmux for Mere Mortals

#66
post #37
post #18

Earlier quoted context omitted.

> realizing it was never going to work how I liked. > You can't have it all with the mouse no matter your settings > so I went back to just using the cursor to move things around. These tools (vim, tmux, etc.) work great for mouseless setups. If you can get comfortable with a 100% keyboard control paradigm, it might work for you. I realize this might not be what you want, but if the statement "spend less time moving…

My biggest problem with "mouseless tmux" was copy-paste. How do you deal with that?

It's very similar to how it works in Emacs

Re: Tmux for Mere Mortals

#67

I have honestly never seen any big value in using tmux over screen. I do all the multiplexing in my window manager and I use tilix which allows me to sync commands over multiple sessions.

tmux has been around for as long as I've been using a CLI daily and both tmux and screen have the same overhead for installing from a package manager. I'm not using tmux over screen: I'm just using tmux.

Re: Tmux for Mere Mortals

#68
post #37

Earlier quoted context omitted.

My biggest problem with "mouseless tmux" was copy-paste. How do you deal with that?

C-b [ goes into copy mode,then you can traverse the screen with arrows. C-Space marks a region, move arrows to select text, and M-w to copy to clipboard. q to escape copy mode

I'm used to selecting only with Space, and confirming with Enter. C-b ] pastes.

This seems to be to the tmux's own clipboard. When you want to copy externally many lines, you can use C-b Z to zoom or use a lame workaround with text files opened in gedit or something. (It's a marginal use case in my experience, so I didn't bother to optimize.)

Re: Tmux for Mere Mortals

#69
post #52

Earlier quoted context omitted.

No, it's not the internal "copy mode" of tmux, it's integrated with xclip (or xsel) so works via the normal clipboard I'm using in other applications too, it's basically the entire point of the tmux-yank plugin and why I shared it. Tagline from GitHub: > Tmux plugin for copying to system clipboard https://github.com/tmux-plugins/tmux-yank I could understand if you don't like tmux for other reasons (being a heavy mous…

> I could understand if you don't like tmux for other reasons I love tmux and I'm primarily a keyboard user. But sometimes I like to copy a short string from one window to another. Does tmux-yank allow you to middle-click paste on a tmux window? does it allow to select to copy?

Middle-click paste is an option offered by the terminal application. It has nothing to do with tmux

Re: Tmux for Mere Mortals

#70
post #52

Earlier quoted context omitted.

No, it's not the internal "copy mode" of tmux, it's integrated with xclip (or xsel) so works via the normal clipboard I'm using in other applications too, it's basically the entire point of the tmux-yank plugin and why I shared it. Tagline from GitHub: > Tmux plugin for copying to system clipboard https://github.com/tmux-plugins/tmux-yank I could understand if you don't like tmux for other reasons (being a heavy mous…

> I could understand if you don't like tmux for other reasons I love tmux and I'm primarily a keyboard user. But sometimes I like to copy a short string from one window to another. Does tmux-yank allow you to middle-click paste on a tmux window? does it allow to select to copy?

Middle-click I don't know about, as I never use it. Usually I don't even have a mouse connected to my computer so I'm limited to a keyboard only. I use the provided `yank` (prefix+y by default) to copy and normal ctrl+shift+v to paste in terminal. Then in other applications I just use ctrl+v and ctrl+c normally.

For the "select to copy", all the information you need is in the GitHub repository previously linked. Here it is again: https://github.com/tmux-plugins/tmux-yank The specific section you're looking for is here: https://github.com/tmux-plugins/tmux-yank#mouse-support

It's simple for you to try it out as well, have a read about tmux plugins and you'll be up and running in a yiffy.

Also take some time to read up on terminal emulators, shells and what tmux is, as you seem to hold slightly off assumptions around where the problems you're experiencing are actually coming from. The reading and understanding will only make your personal knowledge base larger and deeper :)

Post reply on HN