4 ms·
So many people miss the point of tmux. The only reason to still use tmux (or screen) is because you use remote sessions. All modern terminal emulators are alre
by godelski 1y ago
So many people miss the point of tmux.
The only reason to still use tmux (or screen) is because you use remote sessions. All modern terminal emulators are already capable of doing tabs and panes (okay, maybe not sessions, but some can locally). If you're using tmux for this reason, stop. Go pick up a modern terminal like ghostty, Alacritty, or WezTerm.
But why tmux still exists today is because people are working on computers they aren't sitting in front of. Because I don't want to have to be running nohup or detaching, moving to the background, and resetting the session so error messages don't appear in my active instance. Hell, technically I can do this with vim and get something pretty similar to tmux by using the terminal. But that's a pain.
Tmux is for *terminals*
- EPendragon 1y agoFor me tmux ended up being the solution for my dev needs. With a little bit of time, I learnt the ropes and became more or less productive with the default setup. Afterwards, I made it my own. Like you mention, tmux sessions was one of the biggest features that I enjoyed about this tool: it does the job and does it well. Aside from that I love that I can use Vim-bindings with it, that it feels very similar to Neovim for me, so using them together is a no-brainer. Learning a couple of specific keyboard shortcuts is all it takes to make me productive. I haven't needed to use a remote session yet like you note. While working with tmux locally I have learnt about all of these other features that I will definitely be looking forward to using once the opportunity arises. I don't doubt that tools like ghostty, Alacritty, or WezTerm are great. I have heard lots about the first two. And I do intend to check them out. What would you say is your favorite terminal and why as it relates to local development experience use? Are there features that these tools have that tmux lacks?
- godelski 1y ago> What would you say is your favorite terminal So far, ghostty. I do also like Alacritty and WezTerm, and think kitty is overhyped (and Warp is a privacy nightmare). A thing I really like about ghostty is it is incredibly easy to maintain. By far my smallest config file. Basically my theme and a few custom bindings. To be honest, there isn't a huge difference between all of them, with some being better at one thing than another, but I think ghostty gets things good all around. Btw, vim bindings should already be available in your emulator, without the need for tmux. You can set bash to use them (set -o vi) but I suggest migrating to zsh if you like using the cli. I'll also give you one fun command most people don't know. While holding control, press x then e (if you are already using zsh you might need to add `zle -N edit-command-line` to your rc file but <C-x><C-e> needs no config in bash). I guess I should also mention that in vim you can open a terminal (:help term) > why as it relates to local development experience use? All these emulators can do, locally, everything tmux can do and more. You just have to remember that a session is the same thing as a window. All these emulators have tabs and splits. So there is no real advantage to tmux. > Are there features that these tools have that tmux lacks? First off, switch because your emulator is probably more resource intensive. It may also be missing modern features like being able to view images (see sixel, chafa, or the kitty graphics protocol), ligatures, and a lot of other features. Second, tmux lacks many of these modern features. Doing a passthrough can help but dealing with images is not a great experience. I have found no configuration where I can reliably view images and never have been able to produce images of the same quality. I always drop out of my session if I am entering a file browser like yazi or fzf (I'll use fzf but it limits the capabilities of previewing).
- EPendragon 1y agoAppreciate the detailed answer! I will need to take a look at different terminals to see if there is any other one that can better fit my needs. I prefer the idea of having one tool to manage everything: from local flow to remote sessions. And I usually do not view images in the terminal. But I'm willing to put them to the test and see if I like one of those more.
- godelski 1y ago> I prefer the idea of having one tool to manage everything: from local flow to remote sessions. This is still achieved. But as outlined here and elsewhere, a single extra keypress is not so much a hindrance as it is a reminder of be being local vs remote. I'll add that your muscle memory will adapt to whatever pretty quickly. Like I was switching between a mac and a linux machine with a keyboard frequently and it only took a week to forget where my pinky needed to go to hit ctrl. Same is true even if your bindings for whatever are not identical local or remote (though mine are very similar, just differing in the prefix). So I'd say when testing things make sure you include a burn-in time, otherwise any change is going to make all other options feel worse. > I usually do not view images in the terminal. I work in computer vision (ML) so this is a very useful feature. But given that essentially everything else is the same, things don't really feel that different when remote vs local. Just a little purposeful visual indication and a different prefix (which is on purpose).
- grep_name 1y agoI feel compelled to reply, because a lot of this contradicts my experience. I use wezterm + tmux on linux, iterm + tmux on mac. (Already an advantage there, tbh) > vim bindings should already be available in your emulator, without the need for tmux They may mean things like the vim-tmux navigator plugin, which makes it so if you hit e.g. the left-most window in vim and hit your go-left keybinding, it will go one tmux pane to the left. It's pretty crazy how seamless it is, and it's made possible by the fact that you can query tmux outside of the process and run commands on your running sessions, which I'm not sure you can do with any of the standalone terminals? Tmux also doesn't prevent you from using c-x e. I'm aware of the vim terminal, but I'm very picky about my multiplexing and have not been satisfied by any built-in terminal in any editor. > You just have to remember that a session is the same thing as a window. A session is certainly NOT a window. It is a buffer. There is a difference, and that difference matters and comes with advantages that are separate from the advantages of windows. > First off, switch because your emulator is probably more resource intensive I'm not entirely sure if this is true, but it's utterly uncompelling to me. Holding my binding for 'switch window' will switch through n windows faster than I can mentally digest, and the lag is lighter than any gui app I've used. > It may also be missing modern features like being able to view images (see sixel, chafa, or the kitty graphics protocol), ligatures, and a lot of other features I'm not sure why you'd assume this? My setup (wezterm or iterm + tmux + fira code) indeed has ligatures and sharp image viewing passed through the multiplexer > Second, tmux lacks many of these modern features. Doing a passthrough can help but dealing with images is not a great experience. I have found no configuration where I can reliably view images and never have been able to produce images of the same quality. I always drop out of my session if I am entering a file browser like yazi or fzf Yazi is exactly what I use, and it works great with iTerm + tmux or wezterm + tmux. I really don't want my terminal to do that much for me to be honest. I change terminals every couple years, and it's nice to not have to fuss around with them whenever that happens. I haven't changed my tmux config in about 15 years
- apazzolini 1y ago> The only reason to still use tmux (or screen) is because you use remote sessions Do you think it's possible that someone might have a different workflow from you and tmux fits their use case in a way you haven't thought of?
- godelski 1y agoYes, of course. What I'm trying to communicate is that if you're just doing things locally you can get all the benefits (sin sessions) from modern terminal emulators. Most people are using panes and tabs but switching to another terminal emulator will get you these and much more. If you're using the default terminal emulator, you should probably switch (you're installing a program anyways, right?). That said, I still use tmux. Almost every day in fact. Because all my work is being done on a machine I'm not sitting in front of. This even includes at home. My main desktop is connected to a TV for videogames and movies. When I want to do work on it there's no difference if I'm sitting in front of my laptop or it other than it sitting in my livingroom keeps it cooler and gives it better air flow. Edit: Locally: my terminal emulator (ghostty) can do everything tmux can. I can do sessions (windows), panes, tabs, and all that. But with ghostty I also get images, a lower memory footprint (than stock emulator), lower CPU usage (than stock emulator), ligatures, and everything else. It is strictly better. But I can't do {widows,panes,tabs} with remote connections. Hence, tmux. Which in that case, I will frequently give up capabilities (like images) for that.
- newlisp 1y agoYou don't mention the persistence of tmux sessions, which I find very useful for local development. Does ghostty have a client-server architecture too?
- godelski 1y agoYou mean like `window-save-state`[0]? (Windows and sessions are the same thing) You don't need a server to handle this feature. Using a non-server solution even allows restoring after power cycles! [0] https://ghostty.org/docs/config/reference#window-save-state https://ghostty.org/docs/config/reference#window-save-state
- quesera 1y agoUsing tmux locally lets me use a single interface and interaction model for multiple sessions, regardless of whether they are local, remote, or a mix of both.
- kombine 1y agoI always find it annoying to manage nested tmux sessions so I usually use Kitty's keyboard driven tab management and tmux for server side sessions.
- EPendragon 1y agoIt is interesting to see that you use tmux and Kitty together. Is it faster or more convenient than using just one tool?
- quesera 1y agoI have a status line indicator to show whether tmux is in Control mode. So, even when nested, it's always clear what will happen. One nested session (two total) is manageable. Adding another gets annoying, but the need is rare.
- godelski 1y agoI've also tried the status line indicator but it's difficult to balance between being too visible and invisible. So just leads to doing the right commands on the wrong session. Though I find any nested session is rarely needed. I mean locally, a session is a window so I do that.
- quesera 1y agoI haven't had a problem with indicator visibility, but I remember spending some time getting it to a place that worked for me. Here's what I use: set -g status-left "#{?client_prefix,#[bg=colour76]^,#[bg=colour235]_} [#S]" set -g status-right ' | #[fg=colour76]#h#[fg=default] %H%M%Z' Right side included just for completeness. The conditional colour setting was the useful part, IIRC.
- Zizizizz 1y agoI use ghostty and native splits, however there is no way to move a pane to a new tab. Which you can do in tmux very easily. That's one thing I wish it could do.
- godelski 1y agoWhile this doesn't address that issue you can move a tab to a new window (session) as well as merge. I do wish this feature existed, but I use it so rarely that honestly I don't notice. Rarely are more than one pane essential in a given tab, so usually I solve this by cleanup. But yeah, I will acknowledge that limit.
- urquhartfe 1y ago> okay, maybe not sessions Okay, but sessions are one of the best things about tmux. Sessions aside, in my opinion tmux's flow is just better than terminal emulators I've tried. It slots into my brain in a way no terminal emulator's tabbing support ever has, and I have never found a terminal emulator who supported keybindings in such a sophisticated and seamless manner as tmux does. I also concur with other commenters, who mention that having uniform multiplexing of shell windows between local and remote environments is super useful for muscle memory.
- accrual 1y ago> having uniform multiplexing of shell windows between local and remote environments is super useful for muscle memory. Yep, this is why I use the same .tmux.conf on my servers and my local machines. I don't have to care about my terminal emulator - I might be using a fully featured Windows Terminal or iTerm, or I might be using xterm or st on some spartan system. My navigation works the same everywhere.
- godelski 1y ago> My navigation works the same everywhere. Is this really a requirement of tmux though? I have essentially this. Essentially, because I purposefully change my prefix for my emulator to remind me if I'm local or remote (tmux), but other than that it is fairly uniform.
- EPendragon 1y agoKeybindings and uniform experience across machines is what does it for me.
- godelski 1y ago> Okay, but sessions are one of the best things about tmux. Locally or remotely? Remotely I fully agree. But remotely I can't open a new window and my machine doesn't have different workspaces. > Sessions aside I'm curious about this actually. The opposite has been true in my experience. What keybindings are you missing? I can keybind essentially any script I want or any set of keystrokes. > uniform multiplexing of shell windows between local and remote environments is super useful for muscle memory. I actually have the opposite experience. I mean I can bind ghostty splits to be identical to my tmux bindings, that's not an issue and trivial to merge. But I keep them separate because it contextualizes if I'm "here" or "there". Similarly I ensure that remote sessions have a different PS1 line so there are visual indications of where I am other than one small icon. Without this I find that it is easy to forget which machine I'm in. Had too many problems where I was running commands on one machine thinking I was in another.
- osmsucks 1y agoI would mostly agree, but I like that I can use tmux locally and remotely and thus have the same interface wherever I do my work (and regardless of what terminal I use). Then, there's the fact that some terminals capture too many keybindings and get in the way of some terminal code editors I'd like to use (e.g. recently I was again trying to use flow <https://github.com/neurocyte/flow https://github.com/neurocyte/flow> and its next-tab and previous-tab shortcuts clash with Ghostty's). If I had a terminal that 1) was nothing but a black box with the capability to display Unicode font glyphs and ligatures correctly, 2) works under Wayland, and 3) captures as few keybindings as possible, I'd use it locally with tmux and live happy.
- godelski 1y ago> I like that I can use tmux locally and remotely and thus have the same interface wherever I do my work The reason I don't do this (even though a trivial config could make this possible) is I want more indications that I'm remote vs local. I'll even change the remote status bar (sometimes theme) so there's more visual indication (an icon helps, but it quickly becomes invisible, just like the hostname). To be clear, I don't have a pattern for every machine, just 2: local vs remote. Everything remote starts with my tmux binding (<C-b> sucks and requires an absurd hand movement, so I use <C-s> because who freezes these days?). With this I still keep all my muscle memory but have a clear signal of "remote vs local" and prevents silly mistakes. > (e.g. recently I was again trying to use flow <https://github.com/neurocyte/flow> and its next-tab and previous-tab shortcuts clash with Ghostty's) I don't think I understand this example. There's only so many keybindings and clashes aren't uncommon. There's only 45 control commands (without shift or f-keys) and less than half are convenient due to reach (<C-6> sucks!). Even fewer when you start thinking about "sane defaults" and unfortunately those are biased by the past, so collisions become more likely. Like I use vim so frequently hit <C-w> while typing and when I'm not on mac I kill browser tabs (probably for the best lol). But the benefit of all CLI programs is the config. There's no "one-size-fits-all" solution, so having configuration is the next best thing. > If I had a terminal that I'm not sure what emulator doesn't meet these goals. Foot is a barebones solution, so that might be good for you. But if the issue is clashing with keybindings then that's an unavoidable problem, though luckily solvable. At least the emulators tend to provide better flexibility in this respect than most programs do.
- kriops 1y agoI love Alacritty, but it does not have tabs. You need to use, e.g., tmux for that. ZelliJ if you want the fully oxidized experience.