Live data from Hacker News

Using tmux properly

danielallendeutsch.com

51–60 of 218 posts

Re: Using tmux properly

#51
post #33

Yesterday I was helping a friend setting a box with no graphical session: I fired up tmux in the linux virtual terminal and then proceeded to realize without my tmux.conf I couldn't do a thing because I have always been using entirely different keybindings from the default. This is the problem with too much customization. Learning to use the default configuration may be difficult but it's probably worth the effort, f…

It gets worse when you work in ops and are constantly needing to remote into servers and you regularly have tmux within a tmux within a tmux... Littering config files across the datacenter just isn't an option.

I learned to give up making things exactly to my liking and learn to use the default key bindings.

Now I can log into any machine and be 100% productive.

Re: Using tmux properly

#52
post #32

Does mouse copy and paste work correctly with tmux? I find that it selects spans across multiple panes. Is there a way to fix this or Windows or Linux?

I use the "PREFIX z" command to "maximize" the current pane, that is, it hides all the other panes and makes the current one the only visible pane, filling the whole terminal. Then I copy, and "PREFIX z" again to go back.

Clever! You just solved my main issue with tmux!

Re: Using tmux properly

#53

It still sounds like a very shallow (naive?) use of tmux to me, I'm in no way a real power user of tmux and I use a lot more feature than that. You could talk about binds without prefix, sessions, customized status bar, pane swapping, bind keys to script launching, plugins, pane highlighting... And the best feature of all for me: maximized pane toggle. I use that ALL the time. I never could find all features I needed…

I agree, I'm less of a power user than you and still had the same feeling.

Re: Using tmux properly

#54

I basically use tmux as my window manager. I only typically open two programs: a browser, and a terminal. Both are always in full-screen mode. It makes things nice and simple. No matter if I'm working on a laptop or a desktop, all my terminal windows end up in the same place and have the same settings. It's great!

If you are already going that far, why not just switch to a tiling window manager?

Re: Using tmux properly

#55
post #44
post #42

Earlier quoted context omitted.

The thing about tmux bindings is that, as far as I know, very few people like the defaults. I've taken the approach of 'learn the defaults' for vim, but on tmux that simply won't stand because the defaults have so much room for improvement. Pretty much everything I've read on tmux suggests the - and | bindings for window splits, same goes for hjkl bindings for movement. Adding these bindings would go a long way towar…

Yeah, I learned screen defaults, so ^A is far too strong of a habit to change.

I never used screen and still did the rebind simply for the easy 1-handed operation. I ignored the prefix change because I've actually hear some people prefer the default ^B. I know of no-one who prefers % and " for pane splits.

Re: Using tmux properly

#56

My favorite tip: add bindings with the control key. So if you use "Ctrl-b n" to go to the next pane, add a binding for "Ctrl-b Ctrl-n". It's easier to keep the Ctrl key pressed than to lift it.

Here I've been letting go and re-pressing the Ctrl key. Thanks for the tip :D

Re: Using tmux properly

#57

What's the advantage of tmux over something like terminator with pane splitting?

Terminator is an alternative to something like iTerm. Tmux is server based so the sessions persist after disconnecting from ssh for example and allow multiple users to connect to the same terminal

Out of curiosity, would you still use terminator/iterm if you used tmux in every shell?

I understand term* provides some additional functions, but would you still consider it worthwhile?

Re: Using tmux properly

#58
post #32

Does mouse copy and paste work correctly with tmux? I find that it selects spans across multiple panes. Is there a way to fix this or Windows or Linux?

Panes in tmux are only logical, not physical, you can't avoid it. You can either maximize your pane (which is the best feature of tmux for me :)) or use the copy-mode (so, not the mouse)

Copy mode works with the mouse simply by using mouse-enable.

It'll still copy to the tmux buffer, not any system clipboard.

Re: Using tmux properly

#59

It still sounds like a very shallow (naive?) use of tmux to me, I'm in no way a real power user of tmux and I use a lot more feature than that. You could talk about binds without prefix, sessions, customized status bar, pane swapping, bind keys to script launching, plugins, pane highlighting... And the best feature of all for me: maximized pane toggle. I use that ALL the time. I never could find all features I needed…

Do you have any better recommendations on what to read in this case? If you do, I would love to read them! If not, you could do a great thing and use your knowledge to help the rest of us out.

Re: Using tmux properly

#60

Earlier quoted context omitted.

You do one better - tmux's mouse mode allows you to scroll with your mouse wheel. Just add 'set -g mouse on' to your ~/.tmux.conf. You can configure the history size limit by setting 'set-option -g history-limit '. When you scroll the mouse wheel, tmux will enter copy mode and scroll.

The problem is, my terminal already has a concept of scrolling, and its own concept of a buffer, with its own concept of keeping unlimited contents based on available memory, etc. I've never seen a tmux setup that doesn't fail horribly when these two concepts collide (I can't cmd-f search the buffer for interesting things, I don't get a scroll bar on the right that shows me how far up the buffer I am, scroll accelera…

>The problem is, my terminal already has a concept of scrolling, and its own concept of a buffer, with its own concept of keeping unlimited contents based on available memory, etc.

Perhaps try iTerm2 (for Mac) native tmux integration. You can have tmux panes and split panes that are (and behave like) regular terminal panes and tabs.

Post reply on HN