Live data from Hacker News

Tmux Tutorial

leimao.github.io

131–140 of 166 posts

Re: Tmux Tutorial

#132
post #2

I have been using screen for almost 10 years now, is it worth switching? I know it's not much learning but why switching when screen is not broken? It feels like there's more important stuff I can learn.

Another option would be to split screen's roles of "terminal multiplexer" and "terminal detacher" into two programs: dvtm and abduco, respectively. I find that approach more flexible than screen/tmux, and it works better spanning work environments where I might or might not have tabs and splits built in to my window manager or terminal emulator. It's also nice to not have to give up C-a or C-b keybindings when I don'…

When starting my GNU Screen journey 10-ish years ago, I immediately switched the meta key to Ctrl-K, which I had never used for anything in any app up to that point.

Re: Tmux Tutorial

#133
post #123

What about byobu built on top of tmux? Isn't it more straightforward?

I've not used byobu in about a decade, but it has crashed on me in the past. I've never had tmux crash.

The other thing I didn't care w/byobu was that it had a clock in the bottom row. Once a minute my terminal window would light up telling me that something on that tab had changed.

Re: Tmux Tutorial

#134

Pro-tip: if you are using iTerm2, you can set this as your "Send text as start" and always be in a tmux session: tmux attach || tmux new -s main I also recommend remapping ctrl-b to ctrl-space (set -g prefix C-Space). Easier to hit and as a bonus, ctrl-b will work as expected when connected to a remote tmux session.

If you ever use more than one session, I think you'll probably need to change that to `tmux attach -t main`

Re: Tmux Tutorial

#135
post #2

I have been using screen for almost 10 years now, is it worth switching? I know it's not much learning but why switching when screen is not broken? It feels like there's more important stuff I can learn.

I'm a long-time screen user, and I recently switched to tmux purely because it seems to handle high-color and unicode more cleanly than screen. I configured it to completely replicate my screen setup so that I didn't have to learn anything.

Re: Tmux Tutorial

#136
post #2

I have been using screen for almost 10 years now, is it worth switching? I know it's not much learning but why switching when screen is not broken? It feels like there's more important stuff I can learn.

I'm a long-time screen user, and I recently switched to tmux purely because it seems to handle high-color and unicode more cleanly than screen. I configured it to completely replicate my screen setup so that I didn't have to learn anything.

Do you mind posting your rc files for this config?

Re: Tmux Tutorial

#137
post #68
post #58

Earlier quoted context omitted.

Not sure why ctrl-a and ctrl-b are such popular prefixes, I use both a lot editing readline.

Exactly! Have you found any decent replacement?

I use a backtick, but don't edit much e.g. markdown in my tmux sessions, and always use $(...) for command substitution so I don't normally feel any pain. One oddity with tmux is that to escape the control character you don't press it twice, you press the escape char then ctrl-b, so that is a lot of extra movement around the keyboard

Re: Tmux Tutorial

#138

For those who customize their configs and, like me, SSH into all kinds of different short- and long-lived servers regularly: How do you stay sane? I don't want to have to scp over my tmux conf to every single server I jump on, but OTOH difference in pretty much anything but the prefix gets really frustrating with habits. Particularly remembering all the emacs mode-keys when I really want the vi ones.

if you use iterm2 on a Mac, and aren't colour-blind, then there's a somewhat cool thing you can do with zsh+ssh: based on the hostname, change the colour of the tab to represent something like dev/test/qa/uat/stage/prod/etc.

Here's roughly what I use: https://gist.github.com/anthonyclarka2/f2aae1e167c7899d7d263...

It could also be adapted to anything other than ssh. For instance kubectl, aws cli, virtualenvs, etc etc.

Let me know if this helps, and if you have any suggestions!

Re: Tmux Tutorial

#139
post #64

Earlier quoted context omitted.

There is no agreement on what is sensible and what is not, the defaults are no more or less sensible than any other suggestion.

Oh, yes there are. C-b is terrible for your wrist, especially in conjunction with the following commands. Choosing C-a isn't as much about preference as it is about not-terrible ergonomics. Now people are right to prefer anything other than C-a or C-b but C-a is objectively a much saner default than C-b.

> C-b is terrible for your wrist

I always use the modifier key on the opposite side of the keyboard to avoid that issue. So for ctrl-b , I press the ctrl key on the right side of the keyboard worth my right pinky and press the b key with my left index finger.

Re: Tmux Tutorial

#140
post #2

I have been using screen for almost 10 years now, is it worth switching? I know it's not much learning but why switching when screen is not broken? It feels like there's more important stuff I can learn.

> I have been using screen for almost 10 years now, is it worth switching? I've been happy with the switch. I was a long-time `screen` user, too, and something that helped me a lot with the switch to tmux was adding a few lines to my ~/.tmux.conf to change the command prefix from ^b to ^a, like screen. It made the muscle-memory shortcuts I'd used for so long still basically work. unbind C-b set -g prefix C-a bind-key…

I switched from screen to tmux two days ago (after a few failed switchover attempts in the past) and "bind-key a send-prefix" was the big thing I was most missing. Thanks for that one.
Post reply on HN