The Power of Tmux Hooks
devel.tech
devel.tech
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
tmux
command not found
screenI'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.
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?
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.
[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://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:
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" mkfifo notify.pipe
grep 'error' < notify.pipe | notify-macosx-or-whatever >/dev/null &
compile-whatever | tee notify.pipe
Edit: You can do this WAY more simply with bash >() pipes. compile | tee >(grep 'error' | notify >/dev/null)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.
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.