Live data from Hacker News

Getting Started with Tmux

ittavern.com

101–110 of 160 posts

Re: Getting Started with Tmux

#102

The best way to use tmux is with -CC, which iTerm maps to native UI. tmux tabs and panes become native tabs and panes and your session is immortal, and it’s a far better experience than mosh or whatever the latest thing in this area is. I have never bothered to figure out how the keybindings actually work and I probably never will, but I enjoy using it all the time because of this.

The other great reason to use iTerm to run tmux is that copy and paste work correctly.

I started doing this last week along with tmuxp for managing window sets. It works great.

Re: Getting Started with Tmux

#103

My favourite tmux trick only works on an apple gb keyboard: set -g prefix ` bind-key e send-prefix Then, all your tmux controls are one left pinky press away (` is beside z on uk Mac keyboards). (`e sends a ` for when you need it, rare though, $() is better for sub shells :})

Unless you already took that mentality to the next step, and put your Esc key where the most people have their backtick key, with the (comparatively rarely used) backtick key on a second layer.

But then again those types of users are also likely already hyper aware of hotkey modifications and optimizations.

Re: Getting Started with Tmux

#104
Since no one's mentioned it in the comments, I occasionally use tmux's pane synchronization to run the same command across multiple panes: CTRL-B, then "set synchronize-panes". I've done this to do things like log into multiple different servers and startup some process all at the same time. 'set synchronize-panes' toggles this behavior, so when you're done, run the same command again to disable it.

Re: Getting Started with Tmux

#105
One important feature is to enter copy mode, select and copy text without using mouse

enter copy mode: LEADER [

highlight text to copy: press space and then arrow w and b to highlight words (like vi editor)

exit copy mode: press enter key or Q

paste copied text: LEADER ] OR cmd+V

Re: Getting Started with Tmux

#106

The only extra thing I want from tmux is to persist sessions across reboots and shutdowns. I found a plugin called tmux-resurrect but it would be nice as a base feature.

I use https://github.com/tmuxinator/tmuxinator for my workspaces. Doesn't save ad-hoc layouts, but usually I find one layout that works per project, then create a tmuxinator config for it, so after reboot, it's a short "tmuxinator start $my-project" away to get back to how I want it to be.

https://tmuxp.git-pull.com/ does the same thing, but I think it's smoother to work with. It does support freezing current panes. yaml config

Re: Getting Started with Tmux

#107

I've used Tmux/Screen the few times I've had to be in an actual terminal, but don't really see the use for them when using a GUI terminal emulator. I just open new tabs or (rarely) windows as needed. Could anyone using these explain what it provides that you find useful in practice? I rarely ever need persistence of shell when I close the console, is that a common need? Familiarity/muscle memory of shortcuts is a val…

In roles like research it happens that one spends tons of time on the command line. It's normal for me to have spent more time in a week running commands in the terminal than writing code.

Re: Getting Started with Tmux

#108

My favourite tmux trick only works on an apple gb keyboard: set -g prefix ` bind-key e send-prefix Then, all your tmux controls are one left pinky press away (` is beside z on uk Mac keyboards). (`e sends a ` for when you need it, rare though, $() is better for sub shells :})

Unless you already took that mentality to the next step, and put your Esc key where the most people have their backtick key, with the (comparatively rarely used) backtick key on a second layer. But then again those types of users are also likely already hyper aware of hotkey modifications and optimizations.

esc is caps lock (vim user) -- although this has the unfortunate effect of making other devs machines virtually impossible to use since for 20+ years I've used caps-lock-as-escape and it's muscle memory now...

Re: Getting Started with Tmux

#109

My favorite antipattern is, you can just leave a script that does an event loop running in the foreground, detatch tmux, and voila, you have a 'server'. Works great in a pinch or when you just don't need to finish it.

lol a startup I worked at literally have a prod web server deployed through tmux like this.

Re: Getting Started with Tmux

#110

Tmux becomes more awesome when you use something like Alacritty or Kitty [EDIT: scratch Kitty, this mainly applies to Alacritty] and map your system's key (Apple's command key or... whatever it would be on Linux or Windows) and use that as your "tmux key". That way you can make single-chord bindings for all things tmux and life becomes better. If you use Vim, adding VimTmuxNavigator[0] improves things so much. For ex…

I would add foot to the list: https://github.com/DanteAlighierin/foot
Post reply on HN