Live data from Hacker News

Getting Started with Tmux

ittavern.com

151–160 of 160 posts

Re: Getting Started with Tmux

#151

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.

But... why not nohup then? Should work just as well, and it's POSIX

Re: Getting Started with Tmux

#152

Earlier quoted context omitted.

I use kitty locally and only usr tmux on remote servers where I would not like to lose my session. Running remote tmux inside a local tmux is just to error prone and forces you to remember different bindings.

There is an approach to use tmux inside tmux without using different set of keybindings. That's what I have been using for couple years and I really like the setup. I have the following binding in my local machine: bind -T root F3 \ set prefix None \;\ set key-table off \;\ set status-left '#[bg=#C678DD,fg=#2C323C](pass-#S)' \;\ set status-style bg=#E06C75 \;\ set window-status-current-style bg=magenta,fg=black \;\ r…

Thanks, this is excellent!

Re: Getting Started with Tmux

#153

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…

Say you have a document you are working on in LaTeX over a few weeks. You might have the command line for compiling, bibtex, and git in one pane, then vim or equivalent in another. Now say you will be moving between home, office, and traveling. If the tmux session is hosted at work you can connect from anywhere and be in the same workspace with the same command history. If you have a dozen other projects happening at…

Thanks, connecting to a remote tmux session makes a lot of sense to me. It hasn't been a significant need in my work so far, but it's something useful to keep in mind when those scenarios arise.

Re: Getting Started with Tmux

#154

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.

Is there yet any linux terminal that supports tmux -CC mode? iTerm is not coming to Linux, and using tmux on anything else feels really meh.

Re: Getting Started with Tmux

#155

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.

Indeed — one of the best tips I learned from HN is to use iTerm2’s Tmux integration so I never have to even think about tmux commands other than tmux -CC to start a session and tmux -CC attach to reattach.

Re: Getting Started with Tmux

#156

Earlier quoted context omitted.

Oh ya, I'm not against function keys or anything, just not for me. Switching to vim 10+ years ago made all my RSI problems go away so now I just like to keep my fingers on the letter keys as much as possible. I don't even like stretching to number row when I can avoid it (though I do all the time, of course).

This sounds silly when I say it out loud, but reaching for the number row always felt like a chore. Of course, when I had to input numbers, I'd still have to reach for the number row. But when numbers were optional, say for vim bindings that take a `[count]`, I opted to look for alternatives instead. A few months ago however, I bought a moonlander keyboard. Now, I've got one of it's keys that, when held, maps the rig…

I don't think that's silly at all—I hate reaching for number keys and not afraid to say it :D

Another comment in here made think about using Karabiner to give myself a keypad with uiojklnm,. (or something). I actually did this when I used to use a flash-able mechanical keyboard, but I like working on my couch too much so I've been all-in on the short-scale apple keyboards for several years now.

Re: Getting Started with Tmux

#157

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…

Just tried Alacritty on my Mac. With no special config. At first glance I find the fonts don’t look as nice as on iTerm. Maybe I’m missing something as to why this is supposed to be better than iTerm.

Re: Getting Started with Tmux

#158
post #154

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.

Is there yet any linux terminal that supports tmux -CC mode? iTerm is not coming to Linux, and using tmux on anything else feels really meh.

https://github.com/wez/wezterm/issues/336 is tracking that for wezterm although I can attest that they're right, it's pretty rough right now

I thought there was another one, but searching for "tmux" in the issues of the major terminal emulators is worthless since there are so many pages

Re: Getting Started with Tmux

#159
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…

Could you please share your script?

Can't post the specifics but something like this as a bash script, if you have any Qs LMK:

#!/usr/bin/env bash

tmux new-session -d -s sessionname

tmux rename-window todo

tmux send-keys -t todo "vim todo" Enter

tmux new-window -d -n dot

tmux send-keys -t dot "cd " Enter

tmux new-window -d -n windowname

tmux send-keys -t windowname "cd ~/reponame" Enter

tmux send-keys -t windowname "commands to run" Enter

tmux attach-session -d -t sessionname

Re: Getting Started with Tmux

#160

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.

I've been using kitty for 3 years now and I love how fast it is. It's the first time I read of other people using it. At my job nobody knows of it.
Post reply on HN