Live data from Hacker News

Getting Started with Tmux

ittavern.com

21–30 of 160 posts

Re: Getting Started with Tmux

#21
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.

Re: Getting Started with Tmux

#22
post #5

I've only used tmux for about One of my favorite scripts to run is a tmux script that creates a new session with about 7 windows of running my company's project (one window for notes, 3 windows for the backend (runner, code, tests), and 3 windows for the client (runner, code, tests). It's even tweaked further to open up the code in vim, and when used in conjunction with something like harpoon.nvim I have access to my…

Also check out tmux-resurrect to save and restore tmux window/pane config including working directories and scrollback. It can also restore running programs, which is sometimes a reasonable thing to do.

https://github.com/tmux-plugins/tmux-resurrect

Re: Getting Started with Tmux

#23

As a heavy GNU Screen user for the last 2 decades it’s always in the back of my mind if I should be switching to tmux. Maybe there is a compatibility mode. For those who switched from screen what was the biggest benefit?

I wrote a decent amount about that here https://www.victorquinn.com/tmux-tutorial

tl;dr tmux has much easier configuration, it is more actively developed and maintained, and now (this isn't in my post) a richer add-on/plugin ecosystem

Re: Getting Started with Tmux

#24

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'm personally a fan of byobu - it moves the shortcuts to function keys.

Byoby looks good, though I never use function keys. I like to keep (almost) everything as close to the homerow as possible, so I don't think I'll ever abandon tmux.

For example, to jump to specific windows within a tab, instead of number keys, I use `cmd-a`, `cmd-s`, `cmd-d`, `cmd-f`, `cmd-q`, `cmd-w`, `cmd-e`, and `cmd-r` for windows 1-8 respectively (I don't have one for 9 since if I ever get past 8 windows, they are usually throwaways).

Re: Getting Started with Tmux

#25
I use iTerm locally and tmux on a dev instance and it's great. The built-in tmux integration[1] is a pleasure to use. On my end, I see a terminal with tabs; if my ssh connection drops, I can just reconnect and magically all the tabs and their states are persisted. In lieu of this integration, I enable the tmux mouse mode which lets me highlight text with the mouse, navigate around splits by clicking in them... great piece of software :)

[1] https://iterm2.com/documentation-tmux-integration.html

Re: Getting Started with Tmux

#26
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.

Re: Getting Started with Tmux

#27

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…

Can you elaborate on Kitty or Alacritty? I couldn't find anything. In fact, the documentation is hostile again tmux [0].

[0] https://sw.kovidgoyal.net/kitty/faq/#i-am-using-tmux-and-hav...

Re: Getting Started with Tmux

#28

As a heavy GNU Screen user for the last 2 decades it’s always in the back of my mind if I should be switching to tmux. Maybe there is a compatibility mode. For those who switched from screen what was the biggest benefit?

This was me. At first it was just like “Hey, prefix is C-b instead of a C-a, so it messes with less” (i.e readline, emacs), then I started to understand the windowing better and it feels a bit more natural with modern terminal emulators. And yes, I know the prefix can be changed.

Overall, I’m still comfortable switching back and forth, but it seems like tmux is the new hotness, so I’m using that most of the time. It’s a bit easier to style, etc.

Re: Getting Started with Tmux

#29

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.

+1 Been running my servers this way, for years.
Post reply on HN