Live data from Hacker News

Getting Started with Tmux

ittavern.com

61–70 of 160 posts

Re: Getting Started with Tmux

#61
If you use a WM with multiple named workspaces/tags - it is nice to have a key binding to run a terminal with a startup script (instead of the default shell) that creates or attaches to a tmux session with same name as the currently active workspace.

Re: Getting Started with Tmux

#62

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…

Interestingly enough, one of the stated goals of kitty is to make the usage of tmux unnecessary. Considering your comment (and many others like it), I don't think that has quite worked out. Still, kitty is one of my favorite terminal emulators and I'd urge anyone who hasn't tried it to give it a shot.

Reading more about Kitty now is peaking my interest. I feel like there is a reason I ignored Kitty in the past but I can't remember.

Re: Getting Started with Tmux

#63

Earlier quoted context omitted.

Interestingly enough, one of the stated goals of kitty is to make the usage of tmux unnecessary. Considering your comment (and many others like it), I don't think that has quite worked out. Still, kitty is one of my favorite terminal emulators and I'd urge anyone who hasn't tried it to give it a shot.

Reading more about Kitty now is peaking my interest. I feel like there is a reason I ignored Kitty in the past but I can't remember.

Piquing, not peaking :)

Re: Getting Started with Tmux

#64

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.

Also been doing this for years. And always wondered about possible disadvantages, or is there any reason why it is not used like this by everyone?

Oh I've definitely been doing it for years, but only for things I don't care very much about. For example, I used to have a password protected livestream of a camera that was literally an ffmpeg command running in a tmux session that would pipe MJPEG data to an nginx instance, and tmux was by far the easiest way to get it going. But the moment I want reliability, automatic restarts, or something easily reproducible, I switch to systemd or a Docker container.

Re: Getting Started with Tmux

#67
post #14
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…

Did you check out tmuxinator? Sounds like you reinvented it, cool, but maybe there’s some inspiration to be had.

> Sounds like you reinvented it

Tmux comes with the ability to script it, intentionally and by design, and it’s very straightforward and simple to open several windows that launch commands in them. Tmuxinator doesn’t reinvent that, and it does add another dependency, and another layer of options and flags and project syntax to learn.

The suggestion to check it out is great, but saying that people who don’t use it are reinventing it is a tad heavy handed. There are good reasons and legitimate scenarios to keep it simple with tmux scripting alone.

Re: Getting Started with Tmux

#68

Earlier quoted context omitted.

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 a…

The main reason for having function keys is that you can have their labels on the screen, and that's intuitive. You can see it with IBM's CICS. Otherwise they are not that useful, and you can see it in eg laptops making Fn a secondary function, with the primary being adjustment of brightness or volume.

Re: Getting Started with Tmux

#69
post #67
post #14

Earlier quoted context omitted.

Did you check out tmuxinator? Sounds like you reinvented it, cool, but maybe there’s some inspiration to be had.

> Sounds like you reinvented it Tmux comes with the ability to script it, intentionally and by design, and it’s very straightforward and simple to open several windows that launch commands in them. Tmuxinator doesn’t reinvent that, and it does add another dependency, and another layer of options and flags and project syntax to learn. The suggestion to check it out is great, but saying that people who don’t use it are…

Absolutely. I think it depends on ruby, too, which is unusual. It’s anyway got some good ideas - declarative config files, etc.

Re: Getting Started with Tmux

#70
post #44

Among many tricks and tips, I recommend mapping `|` and `-` to split panes: bind-key | split-window -h bind-key - split-window -v More on my wiki: https://wiki.rsapkf.org/notes/unix/tmux/

As an alternative for vertical splitting, using _ (instead of -) means both types of splitting require a `shift` which keeps it a little more symmetrical if that's how your brain works!
Post reply on HN