Top
Best
New

Posted by speckx 5 hours ago

Make Tmux Pretty and Usable (2024)(hamvocke.com)
231 points | 167 comments
ndr 4 hours ago|
I gave up on it once I discovered https://zellij.dev/

Just even for how tab and panes are setup, and how it's good for scrolling and text selection with your mouse for copy pasting.

ghshephard 1 hour ago||
The only (deal breaker for me ) weakness of zellij - doesn't support copy/paste from the keyboard (from the screen/scrollback) and doesn't support multiple copy/paste buffers.

I do that roughly every 60-90 seconds with tmux - so, until the zellij developers relent (they suggest the "proper way" of copy paste is to pipe the data into a text editor and use that - but has the downside of not supporting system copy-paste buffers.) - no options other than to stick with tmux (or fork zellij - but that seems a bit much....)

fullstop 2 hours ago|||
I have a few embedded devices where flash space is limited. tmux is so much smaller than zellij, and it's not even close.

Zellij is close to 50 megabytes, but tmux and all dependent libraries (minus libc, it's always there) is about 2 megabytes.

hesdeadjim 4 hours ago|||
100%. Tmux didn’t click for me but Zellij did within 5 minutes. Lifelong Vim user so it felt a lot more familiar.
snapplebobapple 1 hour ago|||
I did the same, however, I recently switched back because zellij has just gotten too annoyingly bloated. I ended up on tmuxp to build my tmux session and autossh to keep me connected to my various ssh sessions and am much happier.
ori_b 1 hour ago|||
Once I discovered window managers and graphics, I stopped using half-baked features to emulate them in the terminal.

I use tmux to reattach to programs after the network connection dies, and not really anything else. I would welcome a version of it that stripped out everything but that, and just replayed the last few pages of scrollback on reattach.

ssivark 30 minutes ago|||
Check out shpool, whose tagline is "Think tmux, then aim... lower" :-)

https://github.com/shell-pool/shpool

setopt 1 hour ago||||
> I would welcome a version of it that stripped out everything but that, and just replayed the last few pages of scrollback on reattach.

Like `dtach`?

ori_b 1 hour ago||
Thanks. Dtach is definitely closer to what I want than tmux, I'll be trying it out this week.
ndr 29 minutes ago|||
window manager like what though?

Mac WM is horrible, I use aerospace to make it tolerable

dns_snek 4 hours ago|||
Cool, I'm one of the lucky ten thousand today. Thanks.
soraki_soladead 4 hours ago||
Context: https://xkcd.com/1053/

Then, if you're like me and read this years ago, play around with the Light Mode dropdown which was new to me. :)

grgergo 2 hours ago||
> play around with the Light Mode dropdown which was new to me. :)

It's this year's April Fools' joke: https://xkcd.com/3227/ :P

senderista 2 hours ago|||
I have been using zmx for the last 2 weeks. It's still a bit buggy (screen repainting) but quite pleasant to use with ghostty.

https://github.com/neurosnap/zmx

kator 1 hour ago|||
I tried tmux so many times, could not commit the sequences to memory, but then zellij was just out of the gate, easy to "discover," and then I started writing plugins (rust wasm), and I even submitted a PR which got accepted to support background colors in panes/tabs.

I am a monthly donor, I think it has the right balance of community plus the lead dev has a vision, opinionated but open to inputs, and focused.

llagerlof 4 hours ago|||
I used tmux for a few years, until one day I discovered Zellij. With its significantly better UI and overall user experience, I was instantly convinced.
nDRDY 4 hours ago|||
This comment would be a lot more convincing if it weren't in response to one expressing the same sentiment :-)
azthecx 4 hours ago||
It is actually true though, I only use tmux nowadays when I am SSHed into a server that I need to do some work on.

The only issues I've had with it is that sometimes it's hot keys conflict with vim, but you can easily turn it temporarily off with ctrl+ g.

If you're already used to tmux I'm not sure you would benefit much from changing, but it definitely has a better out of the box with pane hints, names, and more user friendly hot keys.

brewmarche 3 hours ago||
Maybe give terminal windows in vim a try? vim is not a terminal multiplexer, but if all you need is multiple terminals windows:

:term to open a terminal in a new vim window (or :vert term)

Standard window movements apply (by default the window prefix is Ctrl-W), most important are: Ctrl-W,{hjkl} to switch between windows, Ctrl-W,{<>+-} to resize windows, Ctrl-W,{HJKL} to move windows to edges, Ctrl-W,{qc} to (force) close windows

Enter normal mode of a terminal buffer with Ctrl-W,N: now you can perform vim motions and scroll the output

Enter insert mode with i and you can type into the terminal again

In insert mode: Ctrl-W "x to paste register x, Ctrl-W . to send a literal Ctrl-W. If too annoying, you can change the window prefix of vim

This goes for vim, neovim also has a terminal mode but it works differently I think

fernandotakai 3 hours ago||||
i tried both and i honestly... i didn't see anything different.

i want tmux for three things:

1. easy splits

2. easy scrollback

3. being able to restart a session if my terminal dies

given all that, tmux works exactly as expected.

what are all these "significantly better ui and overall ux"?

dcminter 24 minutes ago|||
My terminal (terminator) does (2) and the "easy" scrollback on tmux messes up the ability to scroll with the mouse, at least with default settings. I just tried it in zellij and that doesn't. Since I'm only using a multiplexor for (3) and zellij does that too, I'm already inclined to switch.

I know I'd get used to them, but the key combos used by tmux seem very odd choices, even to someone who used to code on a real glass tty!

Groxx 2 hours ago|||
There's a number of people who effectively use tmux as their window manager - one terminal window doing literally everything. Locally as well as remotely, but it's more... understandable for remote, where other options are often worse or nonexistent.

For them, there's as much variety of desires as for any other window manager, and there are tons of those. But terminal ones are usually significantly easier to configure in wild ways due to having fewer (but more powerful) knobs to tweak, so a fair number choose just one and configure the heck out of it.

dummydummy1234 4 hours ago|||
Can you use zellij over ssh on a remote server?
TheTaytay 4 hours ago||
Yes you can!
ndr 4 hours ago||
without running zellij on the remote machine? how?
kibwen 3 hours ago||
I'm unclear what's being asked. Zellij is just a TUI-based terminal multiplexer like tmux and screen, you either run it locally and SSH within it to a remote machine, or SSH to a remote machine and run Zellij from within the remote connection.
Kim_Bruning 3 hours ago||
I guess they mean 'have zellij hold your session when you log off/close controlling terminal'. (that would require zellij on remote)
snthpy 2 hours ago|||
This sentiment seems to be shared widely. Is there a good conversion guide for tmux users?

I tried zellij a couple of years ago when it first got popular and it didn't click for me.

ndr 1 hour ago|||
https://zellij.dev/screencasts/

has some starting links, if screencasts do it for you

For me the only glitch was some key binding collision with ghostty/aerospace but it works perfectly out of the box on alacritty for me

baby 2 hours ago|||
Tried it when it came out on mac and it was super glitchy so I gave up. Also usally tmux is useful when I ssh
KetoManx64 4 hours ago|||
Same here. I bounced off it a few times because KDE konsole already had built in tab/pane support but once I picked up neovim the key chords for triggering actions just made so much sense compared to the static key binds of Console that I just started using Zellij for tabs and panes within Console.
christiansafka 3 hours ago|||
If anyone is looking for a slightly higher level management of persistent sessions, we just launched https://haventerminal.com for Mac
garymiklos 3 hours ago||
I prefer smux.dev
imankulov 4 hours ago||
I left tmux for zellij after several unsuccessful attempts to get Shift+Enter working.

Was quite impressed initially and invested weeks in building new muscle memory, but somehow Zellij crashed with panic more than once, leaving all my processes orphaned. Decided to go back to tmux, and found a simple fix for my Shift+Enter issue.

In case anyone is looking for it, the fix is "bind-key -T root S-Enter send-keys C-j" borrowed from https://github.com/anthropics/claude-code/issues/6072.

verall 3 hours ago||
> In case anyone is looking for it, the fix is "bind-key -T root S-Enter send-keys C-j"

I was looking, thank you!

strogonoff 4 hours ago|||
Is it possible for a multiplexer process to die, but in such a bad way that its child processes continue to run?

I’ve been relying on the fact that in the worst-case scenario (if a pane hangs and tmux session becomes unresponsive) I can just kill tmux server and not have to hunt down and kill dozens of individual processes afterwards.

tolciho 3 hours ago||
A `kill -9` will cause many a process to die and give no chance to cleanup any child processes. Some percentage of users continue to use `kill -9` by default, which may result in a mess of a process tree. Otherwise if the crash is bad enough that cleanup code cannot run (maybe it's being run on OpenBSD and an incompetent programmer didn't check the return value of a malloc and for some reason the kernel now nukes the process) then there may be orphan children. There may also be sporadic failures to cleanup if the crash, maybe, causes the whole process to exit before the cleanup code in some other thread can run. System load average may also influence how things maybe go sideways.
a_t48 3 hours ago|||
That depends on how the children were spawned, no? prctl(PR_SET_PDEATHSIG, SIGTERM); or similar will fix this.
strogonoff 3 hours ago|||
TIL. I didn’t know it’s the responsibility of the parent, thought OS automatically handles child processes.
patabyte 2 hours ago|||
Interesting, for me `shift+enter` hasnt worked, but `option+enter` does give me new lines in Claude Code's promptbox inside tmux on MacOS.
lmao_ball 2 hours ago||
Interesting. I’ve just been using ‘\ + enter’
ErroneousBosh 1 hour ago||
What does shift-enter do for you?
skydhash 49 minutes ago||
Maybe some keybind in a software. Another mentions Claude code, so it may be used to enter new line where enter is bound to send the prompt.

Terminal programs don’t see key events. It’s all text. I just checked st (suckless) code and the RETURN key will send “\r” aka carriage return. Control+j is “\n” or line feed.

johnfn 3 hours ago||
Guys, did you know about tmux control mode? It tells the host terminal to treat tmux tabs as actual tabs in the terminal. That means that things like scrollback, tab navigation, copy paste, keyboard shortcuts, etc are all handled natively, and you can visually see all your tmux tabs! It doesn't have great support across all terminals, but it does work great in iTerm 2.

Try `tmux -CC` in iTerm.

For a tmux novice like me, this was a total game changer :)

kelsey98765431 3 hours ago||
this is the only reason i use a mac and in a decade no open source linux terminal has ever implemented this to my knowledge
MisterTea 10 minutes ago|||
The control mode feature was implemented by the developer of iTerm2 for iTerm2: https://github.com/tmux/tmux/wiki/Control-Mode
hnlmorg 2 hours ago|||
I have in https://github.com/lmorg/ttyphoon

I actually don’t like control mode much though. It’s a terrible protocol. Absolutely abysmal design which leads to a plethora of edge case bugs.

At some point I’ll replace tmux control mode entirely but for the moment it solves the immediate problem.

mwpmaybe 3 hours ago||
Holy carp.
sva_ 2 hours ago||
For me, this is missing

    bind-key -n M-n new-window
    bind-key -n M-1 select-window -t :1
    bind-key -n M-2 select-window -t :2
    bind-key -n M-3 select-window -t :3
    bind-key -n M-4 select-window -t :4
    bind-key -n M-5 select-window -t :5
    bind-key -n M-6 select-window -t :6
    bind-key -n M-7 select-window -t :7
    bind-key -n M-8 select-window -t :8
    bind-key -n M-9 select-window -t :9
To switch around quick. So on my system I've got Super-{1-9} for workspaces, Alt-{1-9} for tmux panes.

Also if you want a vi-like copy mode (where you can select and copy stuff) that opens using Alt-/:

    bind-key -n M-/ copy-mode
    set -g status-keys vi
    set-window-option -g mode-keys vi

    # v to trigger selection
    bind-key -T copy-mode-vi v send-keys -X begin-selection
    
    # wl-copy if you use wayland
    # mouse selection in copy mode to copy
    bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "wl-copy"
    # y to copy
    bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
And btw, Ctrl-Shift-v to paste system clipboard

You can also put the config into ~/.config/tmux/tmux.conf

edit: And if you want a powerline-style design:

    set -g pane-border-style "fg=colour252"
    set -g pane-active-border-style "fg=colour25"
    set -g status-style "bg=default,fg=default"
    set -g status-left "#[fg=colour231,bg=colour25,bold] #S #[fg=colour25,bg=default,nobold]"
    set -g status-right "#[fg=colour67,bg=default]#[fg=colour231,bg=colour67] %Y-%m-%d  %H:%M #[fg=colour25,bg=colour67]#[fg=colour231,bg=colour25,bold] #h "
    setw -g window-status-format "#[fg=colour243,bg=default] #I  #W "
    setw -g window-status-current-format "#[fg=colour28,bg=default,reverse]#[fg=colour231,bg=colour28,bold,noreverse] #I  #W #[fg=colour28,bg=default,noreverse]"
Requires powerline-fonts
alecsm 4 hours ago||
I had my tmux customized to the point I forgot how to use it on a clean install which is a problem when I'm sshing into a server.

I wish it had better defaults but now I run it as is. After a while you get used to it. The only thing I always have to change is the mouse scroll and my brain cannot retain the exact command.

dpflan 4 hours ago||
Do you have a "dot files" repo? It would contain things like this, config files for tmux, zsh, <other tools>, etc.
esseph 4 hours ago|||
That may work for a server or two but doesn't really pan out for fleet management.
lanstin 2 hours ago||
Volunteer to be the official image maintainer - I had emacs-nox and (screen) installed fleet wide for my own utility :)

I had a friend that even had his public keys added to the /root/.ssh/ but I didin't go that far -I didn't even put my own .emacs out - but I at least could use good tools to look at the tcpdump output or giant log files if needed. "Eight Megs and Constantly Swapping" is not that big of a deal anymore.

And if people want to just use some default open source image, just point out that in modern cloud environments, you don't want each node to customize itself, you want to pre-run that process one time per node type in your "directed graph of image delta pipelines" which takes the input image and publishes the cloud ready app-specific images (with your DNS configs, LDAP integration, whatever, plus emacs/neovim and screen/tmux :)

mystifyingpoi 42 minutes ago||
This will definitely work, but it's not really even necessary. Just have some pre-connect script, that checks if the host is already "configured", and if not, then one-shot some Ansible playbook (or bash even) that installs what's needed. Use /tmp if root is not available. Also works for Kubernetes, though there we have better options.
throwa356262 3 hours ago|||
Is it not just easier to accept the default config?
carodgers 2 hours ago|||
I've hit this problem multiple times. The approach which finally eased this pain point for me was to take care to not overwrite any tmux defaults with my config, and only add non-conflicting configs (new shortcuts, styling changes, etc.) That way, if I need to use tmux on a new or unfamiliar machine, the core functionality is still present, and I just miss the candy that comes with customization.

For example, leave the existing prefix binding (ctrl-b), but also add something nicer for day-to-day use (ctrl-space or similar).

znpy 3 hours ago|||
> I had my tmux customized to the point I forgot how to use it on a clean install which is a problem when I'm sshing into a server.

I had the same issue with gnu emacs… but at some point i lost my very custom configuration when the disk broke… i resorted to use a mostly-vanilla emacs :)

NobleLie 2 hours ago|||
"Claude, scp my tmux config over to that box"
alt219 4 hours ago||
Why not just `scp ~/.tmux.conf remotehost:`?
al_borland 4 hours ago|||
I can't speak for the parent, but I rarely login to the same remote server twice and don't want to need to set things up and clean them up anytime I do. This is why I try to keep my stuff as close to vanilla as possible. If anything goes wrong on a server and someone sees I have a whole bunch of dot files to customize my config, it becomes a red herring that I have to spend time explaining away.
cr125rider 3 hours ago||
If only we had ways to automate repeating processes… oh well
traderj0e 1 hour ago||
No, wanting to keep things vanilla when you're dealing with lots of random servers is a valid concern. Just because you can solve this with shell scripting doesn't mean you should.
skydhash 38 minutes ago||
You could always copy the config to /tmp and use the -f flag.
monsieurbanana 4 hours ago|||
Sometimes I ssh into a server as a specific user (e.g. as the "app" user that is used to run a web app), sometimes only root is available (probably not best practice, but it's not like I can or want to fix it myself).

In any case it's not practical to carry your dotfiles everywhere you go. Changes are also a hassle to propagate

mmh0000 1 hour ago||
I love tmux! It's perfectly usable! You only need a 400-line custom-built configuration file[1]!

[1] https://doc.xn0.org/.tmux.conf

Disclaimer: I am being silly but serious. tmux is absolutely not user-friendly out of the box. It is, however, extremely nice after an absurd amount of tweaking, which is either an endorsement or a damning, depending on your perspective.

hiAndrewQuinn 1 minute ago||
I include lines at the top of my own https://andrew-quinn.me/tmux-conf.txt to make it easy to download no matter what kind of box I find myself on.

    # Mindless copy and paste command:
    #
    #   # Standard Linux / GNU tools
    #   wget -O ~/.tmux.conf https://andrew-quinn.me/tmux-conf.txt
    #   curl -fsSL https://andrew-quinn.me/tmux-conf.txt -o ~/.tmux.conf
    #   busybox wget -q -O ~/.tmux.conf https://andrew-quinn.me/tmux-conf.txt
    # [... many, many others]
skydhash 42 minutes ago||
Mine is only a few lines copied from jcs’s one.

https://github.com/jcs/dotfiles/blob/master/.tmux.conf

I’ve only reverted the prefix binding back.

seemaze 4 hours ago||
I've been thoroughly impressed with tmux control mode[0] in iTerm2. This lets you manage remote terminal windows with your local window management provider. It is currently in the process of being implemented in ghostty[1] as well, can't wait!

[0] https://github.com/tmux/tmux/wiki/Control-Mode

[1] https://github.com/ghostty-org/ghostty/issues/1935#issuecomm...

zzyzxd 1 hour ago||
> Less awkward prefix keys

> Probably the most common change among tmux users is to change the prefix from the rather awkward C-b to something that’s a little more accessible.

I like the awkwardness of the default prefix key. I have almost never activated it by accident.

> Intuitive Split Commands

> Another thing I personally find quite difficult to remember is the pane splitting commands." to split vertically and % to split horizontally just doesn’t work for my brain.

This is super intuitive to me. two ' in parallel means splitting horizontally. two ° split by an almost horizontal line means splitting vertically.

> Easy Config Reloads

I reloaded config over a few hundreds of times in my first week learning tmux a decade ago. I only reloaded config once in the last 5 years if I recall correctly. It's not something you should memorize.

ghshephard 15 minutes ago|
> I like the awkwardness of the default prefix key.

I am 100% in agreement with you. It takes all of 5 seconds to add:

       unbind-key -T prefix C-b
       set-option -g prefix C-s
 
To your .tmux.conf on your local laptop (where I use tmux 99.99% of the time) - without worrying about conflicting on that once-in-one-year event where you start up tmux remotely.
heatmiser 4 hours ago||
I read "tmux 2: mouse-free productivity" in a weekend years ago and it may be, pound-for-pound, one of the more impactful books on my productivity.

Seems like they are keeping up-to-date too: https://bookshop.org/p/books/tmux-3-productive-mouse-free-de...

tosti 4 hours ago||
The book doesn't mention the author of tmux or its origins even once :(
racl101 3 hours ago||
I believe that book would be called: "History of Tmux"
racl101 3 hours ago||
Thanks for the reference.
toniantunovi 53 minutes ago|
One thing that often gets overlooked in the tmux vs. alternatives debate is that tmux's staying power is largely about ubiquity on remote servers. Zellij is great on your local machine where you control the environment, but if you're doing a lot of work via ssh on machines you don't own, tmux is almost certainly already installed. The muscle memory transfers too.

That said, I'd push back on the idea that the default tmux config is just "ugly". The real usability issue is that the keybindings are so divorced from how people intuitively think about splits and windows that even experienced users can't remember them. The visual defaults are just a symptom of the deeper problem that it was designed for someone who already had a mental model built around screen.

More comments...