Live data from Hacker News

Tmux Tutorial

leimao.github.io

51–60 of 166 posts

Re: Tmux Tutorial

#52
post #50

Looks like some of the shortcuts are really RSI prone, i.e. ctrl + b + & (where & is shift + 7). Are there any possibilities to have more wrist-friendly shortcuts?

Not sure if you know this, but you're not pressing 4 keys at once. The ctrl + b part is the prefix sequence to let tmux know you want to send it commands. The order of key presses would be:

1) press ctrl + b

2) release

3) press shift + 7

You may already know this, and the RSI concerns still stand (I'm not sure what all goes into RSI risks), but wanted to clarify if the concern is over pressing 4 keys at the same time that are all over the keyboard.

Re: Tmux Tutorial

#53
post #50

Looks like some of the shortcuts are really RSI prone, i.e. ctrl + b + & (where & is shift + 7). Are there any possibilities to have more wrist-friendly shortcuts?

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 your command is sent to the inner tmux/screen.

Defaults matter. It is not feasible to configure this on every machine you touch so one have to remember both the default one and the sane one...

Re: Tmux Tutorial

#54
post #53
post #50

Looks like some of the shortcuts are really RSI prone, i.e. ctrl + b + & (where & is shift + 7). Are there any possibilities to have more wrist-friendly shortcuts?

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…

There is no consensus on the best prefix so there is no point in changing it after 10 years. Lots of people dislike C-a.

Re: Tmux Tutorial

#55
post #11

One of the downsides listed when you don't use tmux is that you have to type your password for each terminal you open to the remote machine. Does no one use ssh-agent?

This somewhat painfully breaks when reattaching as the socket from the shells environment could be defunct. Whereas the shell session outside has a different, totally fine agent in its environment. This was somewhat painful to explain to some engineers and I suck at explaining so I’ll gladly receive a good explanation for it (or a nice workaround?) :D

Are you talking about running ssh-agent on the server side? To further connect to some other machine?

For that I use a file to save the name of the socket and PID, and restore this in my .profile.

Re: Tmux Tutorial

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

There is no consensus on the best prefix so there is no point in changing it after 10 years. Lots of people dislike C-a.

I can imagine, what is best will likely depend on preference.

But at least the defaults should be sensible.

Re: Tmux Tutorial

#58
post #25

Earlier quoted context omitted.

I prefer tmux to screen but the default key mappings took some getting used to. I've used it long enough that Ctrl-B and " / % for the screen splitting are natural to me now, but initially it was ... rough.

You could remapped whatever you don’t link. I have Caps Lock set to be Ctrl and tmux set to use Ctrl+a. For a vertical split, I have it mapped to Ctrl+a, |. For horizontal, Ctrl+a, - It’s pretty flexible.

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

Re: Tmux Tutorial

#59
post #40

Cool, a coworker showed me tmux yesterday. One question we had was about scrolling in the tmux window and keeping the terminal output (as in Linux where I can scroll back with Shift+PageUp). Does anybody knows how that works with tmux?

Ctrl+B then page up/down. Mouse works too if you enable it in .tmux.conf

Note that you have to press Q to exit this mode :(

Re: Tmux Tutorial

#60
post #12

One tip I didn't see mentioned (though it's pretty common in tmux) is to use the default window layouts for organizing multiple panes. You do this with Ctrl + b followed by esc + . esc + 1: All windows take up equal space horizontally, and stretch the full vertical width esc + 2: All windows take up equal space vertically, and stretch the full vertical width esc + 3: The first window takes up half of the screen verti…

Thanks for this! :O
Post reply on HN