Live data from Hacker News

Tmux for Mere Mortals

zserge.com

51–60 of 171 posts

Re: Tmux for Mere Mortals

#51
A great feature of tmux is that every action can be automated from the command line using commands such as split-window, resize-pane, and select-layout. With the send-keys and capture-pane commands you can even automate interacting with any process running inside tmux. The man page provides a good overview of these commands. There also exists a wrapper for Python [0] and I'm currently working on one for R [1].

[0] https://github.com/tmux-python/libtmux/

[1] https://github.com/datascienceworkshops/tmuxr

Re: Tmux for Mere Mortals

#52
post #20

Earlier quoted context omitted.

The top reason I did start using tmux was because of how you can select text with the keyboard in copy mode (like visual in vim mode). Then I got the plugin tmux-plugins/tmux-yank which adds "y" command to copy the text. Also works with selection by mouse. I've run this setup now for something like 5 years across multiple tmux versions and OSes (Ubuntu and Arch) without any hiccups. But then I think tmux is a tool ge…

> The top reason I did start using tmux was because of how you can select text with the keyboard in copy mode (like visual in vim mode). Then I got the plugin tmux-plugins/tmux-yank which adds "y" command to copy the text. Also works with selection by mouse. Sure, but this is the internal "copy mode" of tmux, and is not useful to copy text in and out of your terminal.

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 mouse-user for example), that makes perfect sense. It's not for everyone. But if you take some time to understand why some things don't work like you expect it to (like what's the difference between a terminal emulator and tmux, what they have access to and so on) and how you could solve them, you'd avoid the issues you're describing.

But again, tmux is a tool aimed for keyboard users, not mouse. This tool doesn't fit everyone, and that's ok too. If you're willing to try it, you need to understand a few things before it'll work as you expect, otherwise your expectations will be wrong.

Re: Tmux for Mere Mortals

#53
Having tried tmux this week (I'm a screen diehard) and had it entirely disconnect and lose the session without warning because I pressed ... some key combination I have no idea what ... I've put that back into the "eh, maybe" pile for another 5 years.

Re: Tmux for Mere Mortals

#54
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?

I had the very same problem. Especially, I could not jump to the string I wanted to copy. I wrote a tmux plugin for it https://github.com/schasse/tmux-jump Maybe it helps you too. Works great with https://github.com/tmux-plugins/tmux-yank

Re: Tmux for Mere Mortals

#55
Am I missing anything if I’ve always just logged in somewhere and used Emacs within screen? I get to use all the navigation, window management and clipboard commands I’m used to. Very rarely I’ll need to fire up ansi-term which is slightly less integrated I guess.

Re: Tmux for Mere Mortals

#56
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?

    bind-key -T copy-mode-vi 'v' send -X begin-selection
    bind-key -T copy-mode-vi 'y' send -X copy-pipe-and- 
    cancel 'xclip -in -selection clipboard'

Works just like vim. Press v to go into visual mode, then y to yank the selection

Re: Tmux for Mere Mortals

#57
post #10

Spent too much time wonking a tmux config only realizing it was never going to work how I liked. You can't have it all with the mouse no matter your settings, there will always be a compromise. It also doesn't help that no one cites the version of tmux they wrote their configs for, nor that the configs are not backwards compatible with all versions of tmux for all settings. It's really clunky, but I went from tmux to…

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…

This also bothers me. As a keyboard guy it mostly bothered me that I could not jump to the thing that I wanted to copy. I found https://github.com/schasse/tmux-jump, which works really well with https://github.com/tmux-plugins/tmux-yank

Re: Tmux for Mere Mortals

#58
post #37

Earlier quoted context omitted.

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

A typical scrollback cut and paste workflow for me is via this P mapping. I'm lazy I just grab everything. bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer' then it's all in a file you can work with in an editor of your choice

You should be able to replace the capturep/saveb/deleteb dance with 'run "tmux capture-pane -p -S- -E- >%1"'

Re: Tmux for Mere Mortals

#59
post #52

Earlier quoted context omitted.

> The top reason I did start using tmux was because of how you can select text with the keyboard in copy mode (like visual in vim mode). Then I got the plugin tmux-plugins/tmux-yank which adds "y" command to copy the text. Also works with selection by mouse. Sure, but this is the internal "copy mode" of tmux, and is not useful to copy text in and out of your terminal.

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?

Re: Tmux for Mere Mortals

#60
So in the era of containers and kubernetes and devops “if you have to ssh in you’re doing something wrong” does learning tmux still have high value?
Post reply on HN