Live data from Hacker News

Tmux Tutorial

leimao.github.io

151–160 of 166 posts

Re: Tmux Tutorial

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

It's really easy to tell byobu what you want to have in the bottom row. Press F-9 and select "toggle notifications".

Re: Tmux Tutorial

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

Started with tmux, but during 4 years of using it updates broke my config files several times. Then around a year ago turned to screen and am really pleased about the decision: no more config-broking updates; available by default on most systems; by adjusting a few details was able to match my previous tmux setup exactly.

Re: Tmux Tutorial

#154

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.

I have a Github dotfiles repo so I can set it up on any server in a couple of minutes, just by cloning the repo and running a script within it. If you're jumping between different servers, I would highly recommend having a quick way to setup config like this. It's a short investment that pays dividends for many years - not just for tmux config, but setup for bash, vim, and any other utils you rely on. I use one tmux…

Used to have that actually, it's just too much of a hassle in today's cloud environment (I can easily SSH into dozens of fresh instances over a day and there's no way I'm baking my personal config into an image). I was considering to revisit and streamline that, but I imagine the cognitive overhead of different remote hosts having different configs is worse than what I have now (local=my config, remote=vanilla).

I just bind a different prefix and moved the bar to the top locally (I use urxvt+tmux with Ctrl+arrow keys etc to navigate tmux tabs instead of a tabbed terminal client) to get around the nesting issue.

Re: Tmux Tutorial

#155

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.

I use git and GNU stow. ssh in, clone the repo, stow tmux. Takes ~10 seconds on a new host. Also includes all the other dot files I use (bash, vim, etc).

Can't believe I missed stow, this goes straight to the bucket list!

Re: Tmux Tutorial

#156
post #68

Earlier quoted context omitted.

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

Backtick is my favorite too. Interestingly I thought it was an obscure choice, but it seems to be the 3rd most popular prefix from an analysis of tmux.conf files on github (after Ctrl+A and Ctrl+Space). I use `` (double-backtick) to escape the backtick and it's eminently reasonable.

Re: Tmux Tutorial

#157
post #48

We use tmux for remote peer programming in a pinch. If Alice has a session on a remote machine you have access to. You can run `tmux new-session -s bob -t Alice` With this both share he same view but can move cursors independently.

Even better than raw tmux is using tmate. I fumbled with tmux sessions and permissions for awhile but tmate makes it trivial. It's a free service but it really seems like they're leaving money on the table (I'd pay for it, anyway).

Re: Tmux Tutorial

#158
post #104
post #64

Earlier quoted context omitted.

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.

The problem is with ctrl positioning, there was a time when it was more commonly found on the home row [0]. Rebinding caps lock to control turns the motion from an awkward wrist snap to a slight spreading of your left hand fingers. [0] http://xahlee.info/kbd/keyboard_ctrl_vs_capslock_position.ht...

Personally I've bound caps lock to ESC, but given the emacs style shortcuts it does make sense. Thanks.

Re: Tmux Tutorial

#159
post #86
post #53

Earlier quoted context omitted.

A very common change is to change the prefix to ctrl + a, like this in your tmux.conf: # remap prefix from 'C-b' to 'C-a unbind C-b set-option -g prefix C-a bind-key C-a send-prefix I've heard that he reason for ctrl + b is because screen uses ctrl + a, which just doesn't make any sense to me. You can nest both tmux and screen and to get to an inner layer you press (if ctrl + a has been mapped) ctrl + a + a - and now…

I think another reason is because some people use Ctrl+a in bash for jumping to the start of the line.

Thanks, that is a good point!

Re: Tmux Tutorial

#160
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 like ^Z, since it's about the only keybinding that's not used by common terminal software. To actually send a program to sleep, just double up: ^Z^Z

    # In ~/.tmux.conf Change prefix key to Ctrl+z
    unbind C-b
    set -g prefix C-z
Post reply on HN