tmux has geek appeal and I can see the use case for remote sessions, but for local macos dev I've changed to just use iTerm for splits (I tried byobu as well).
tmux seems to need extra yak shaving to get vim integration, copy/paste and scrollback configured nicely and I just couldn't see the benefit over iTerm's native functionality.
Can anyone sell me on tmux over iTerm for local dev?
I don't think it's very useful for local dev, but it is a lifesaver for SSH work on spotty connections (or any other case where you might want to leave a workspace intact despite losing connection). But if you're already using iTerm, you should just use its built in tmux integration, which lets you keep using iTerm splits and windows while iTerm handles the tmux stuff. You can do this by launching tmux with the -CC option:
tmux -CC attach || tmux -CC
This is one of my favorite things about iTerm! Combine that with custom profiles for each server and automatic profile switching (and a few other gems), and working remotely is scarcely harder than working locally!
The vim stuff is not too hard to get around IIRC. I don't remember the details, but you can have a look at my .vimrc [0] if you want an example that works on remote servers through tmux with iterm.
I used to do that, but eventually switched to just raw tmux. If you add automatic tmux session saving (via plugin) this becomes a lot more convenient. Also allows me to have one iTerm tab for each server and display the tmux session from that server. Nested tmuxes do not work very well, even if the outer one is managed by iTerm.
I was in the same boat as you until I realized that I usually run a tmux session for longer than the period between iTerm updates. tmux -CC + bury tmux session setting is awesome.
I develop using Linux but sometimes I have to use macOS. Mostly I work locally but sometimes I work on remote boxes. tmux means I get a consistent experience where ever I am.
I'm not fully versed in what iTerm can do but tmux does splits and tabs. The tabs are very useful. I can also use tmuxinator so I can start up with a standard set of splits and tabs very quickly.
There are the issues you mentioned. But once it's configured I don't find those troubling. And once you change the prefix to something sane it's really nice to use. I enjoy moving around tmux. So for me there are big benefits and tmux is one of the first things I install on a new machine.
I use the same config in Windows, macOS and Linux so I just need to learn once the shortcuts and it works the same everywhere.
I also use it along tmuxinator, which is very convenient to setup sessions. I just need to type "tmuxinator my-project" and it opens the tabs and layouts in the right directories for this project, with "tail -f" running in some panes, mysql client in others, an SSH connection in yet another. Tmuxinator makes configuring all this very straightforward.
Scrollback was a bit annoying at first but I got used to it and it's no longer an issue. Copy and paste can indeed still be an issue especially when sshing to a server.
Can you script iTerm? I usually set up tmux scripts that start a workspace for a project. Splits are set up, a compilation run is started, vim is started with the right files for the project, things like that. Then I can just my_project/start_work.sh and everything is set up the way I like it.
Butter-smooth scrolling as you hold down j in vim. Doesn't have its own scrollback, so use tmux just for that. There is so much less TUI lag, it's on par with using a regular GUI text editor.
Interesting. Could you use the mouse to interact with scrollback using your workflow? I mostly use keyboard but sometimes I just want to flick upwards and copy a block of scrollback text using the mouse.
Great, a complex way to do what should just happen automatically (adjusting to changed resolution or resized terminals).
As a long time vim/tmux user, I'm just done with these powerful tools that I have to spend all my time configuring to make useful (nevermind seamless or delightful). It's masochistic. I have way better, meatier, more meaningful things to work on than my dot files.
Outside of a pure development environment, you can't just install software on a machine. You have to create a change request and have it approved. And the latter just won't happen for stuff like tmux, there's simply no business justification for it.
My point was, it seems odd for a company to have a rule like that but also encourage manually SSHing into servers. That manual administration is already a code smell, in that it’s an I mplicit rejection of immutable infrastructure. So it’s funny that the same company would forego immutable infrastructure while disallowing any installation of packages on the server. Either go all the way or not.
Even at the Fortune x00 companies I've consulted for, I believe I would have been able to get that approved. Any time you are asking people to manually administer boxes, those people are going to want tooling for that job. Manual deploy takes 8+ hours and sometimes ssh sessions time out or are interrupted? We'd like to install a persistent session management tool.
I'm not sure if you're saying that myopic management won't see a business justification or that there truly is not one.
My tmux does resize automatically...? Is there some other kind of resizing that's necessary? I split side-by-side, I make another terminal emulator tiled side-by-side, original term narrows to take half the display, tmux's panes resize so they're still using half the vertical space. I'm really not sure at all what the point of this post was supposed to be.
I keep my build output on watch in a tab and have touched tell macOS to send me a notification when it notices a certain text pattern. It’s especially nice for things like Jekyll rebuilds.
Sure, you dont NEED it, but then you don't need a lot of stuff. I guess the value comes from not having to remember all those commands, just enter the hooks in the config and you have those steps happening automatically for you.
IMO tmux is much cooler when you do stuff like running commands in or sending text to a different window. Check out entr(1) for some sweet use cases that are much more fun than the hooks. That vimdiff thing ... I used it a few months ago when trying to replicate some complicated rollup.js compiler output options. Awesome, even though I own Kaleidoscope.
By the time I save my post and glance towards the browser in other monitor, rebuilding has already finished, and the browser live reload has already displayed the updated post.
Any tmux fans might learn something from the most recent "minimalist guide" discussion, it seemed a bit more in-depth (or perhaps more tips) than others.
30 comments
[ 2.5 ms ] story [ 81.0 ms ] threadtmux seems to need extra yak shaving to get vim integration, copy/paste and scrollback configured nicely and I just couldn't see the benefit over iTerm's native functionality.
Can anyone sell me on tmux over iTerm for local dev?
The vim stuff is not too hard to get around IIRC. I don't remember the details, but you can have a look at my .vimrc [0] if you want an example that works on remote servers through tmux with iterm.
[0] https://github.com/stefco/dotfiles/blob/master/linkfiles/.vi...
I'm not fully versed in what iTerm can do but tmux does splits and tabs. The tabs are very useful. I can also use tmuxinator so I can start up with a standard set of splits and tabs very quickly.
There are the issues you mentioned. But once it's configured I don't find those troubling. And once you change the prefix to something sane it's really nice to use. I enjoy moving around tmux. So for me there are big benefits and tmux is one of the first things I install on a new machine.
I also use it along tmuxinator, which is very convenient to setup sessions. I just need to type "tmuxinator my-project" and it opens the tabs and layouts in the right directories for this project, with "tail -f" running in some panes, mysql client in others, an SSH connection in yet another. Tmuxinator makes configuring all this very straightforward.
Scrollback was a bit annoying at first but I got used to it and it's no longer an issue. Copy and paste can indeed still be an issue especially when sshing to a server.
Butter-smooth scrolling as you hold down j in vim. Doesn't have its own scrollback, so use tmux just for that. There is so much less TUI lag, it's on par with using a regular GUI text editor.
https://github.com/jwilm/alacritty
https://gist.github.com/sijad/771426b3995eb05faeb6d78926645e...
Found in https://github.com/jwilm/alacritty/issues/146
Alacritty might get mouse modifiers to use its own text selection (better for a remote session), but that's good enough for me.
I use, for extra vim niceness:
As a long time vim/tmux user, I'm just done with these powerful tools that I have to spend all my time configuring to make useful (nevermind seamless or delightful). It's masochistic. I have way better, meatier, more meaningful things to work on than my dot files.
I work on ton of remote machines, and it usually goes like
I'm not sure if you're saying that myopic management won't see a business justification or that there truly is not one.
if you have to login, you wont be installing it everywhere.
and yes, we automate it. if I am logging in, it is for post mortems.
As of tmux 2.6:
main-horizontal and main-vertical layouts have a main-pane-height/width that has to be adjusted.
tiled, even-vertical, even-horizontal should automatically resize.
I updated both tmux articles to mention that.
IMO tmux is much cooler when you do stuff like running commands in or sending text to a different window. Check out entr(1) for some sweet use cases that are much more fun than the hooks. That vimdiff thing ... I used it a few months ago when trying to replicate some complicated rollup.js compiler output options. Awesome, even though I own Kaleidoscope.
http://entrproject.org/
I chuckled, I use Hugo :)
By the time I save my post and glance towards the browser in other monitor, rebuilding has already finished, and the browser live reload has already displayed the updated post.
https://news.ycombinator.com/item?id=15776995
https://hn.algolia.com/?query=tmux