Live data from Hacker News

Tmux Tutorial

leimao.github.io

101–110 of 166 posts

Re: Tmux Tutorial

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

instead of ESC you can also use ALT (maybe easier to hit for default keyboard layouts)

Re: Tmux Tutorial

#102
post #74

Earlier quoted context omitted.

Yes. Left ctrl is in a better placement on many keyboards. Also being able to perform shortcuts with one hand is very handy.

If it hurts your wrist pressing it with one hand, perhaps you should use two...

Or choose a shortcut that works with either.

Re: Tmux Tutorial

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

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

Re: Tmux Tutorial

#105

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 prefix for the local machine and another one for ssh sessions (setup in bash_profile using something like `if [[ -n "$SSH_CLIENT" ]] ; then tmux set-prefix ... etc`. You need different prefixes when using tmux recursively like this, so you can navigate both the inner and outer session.

I also use a different color theme for ssh sessions, whch helps to know which prefix to use until it becomes somewhat subconscious.

Re: Tmux Tutorial

#106
post #25

Earlier quoted context omitted.

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.

Forgive me for asking a sort-off-offtopic question, but what's the reason terminals - and therefore the programs which run within them - offer such limited scope for ctrl-key usage. A lot of characters are not available for remapping, such as ctrl-numeric-digit, or ctrl-shift-anything etc. What's the root cause of this? Is it telnet related? ssh? And, assuming there's a compromise somewhere, would it be possible for…

> What's the root cause of this?

It is stems 100% from the terminal emulator. Just install a better one. Test your keys with https://metacpan.org/source/PEVANS/Tickit-0.67/examples/demo...

Screenshot: https://i.imgur.com/JfHjJXy.png

The only key combos marked not ok are global/taken by the window manager, so they don't arrive at the application.

Re: Tmux Tutorial

#107
What's a good way to handle ssh and tmux, if I'm already in a tmux session in my desktop?

I'm in a tmux session in my desktop. Then I ssh into a server from within tmux. I want to start tmux to be able multiplex and detach from some tasks. What do?

Re: Tmux Tutorial

#108

What's a good way to handle ssh and tmux, if I'm already in a tmux session in my desktop? I'm in a tmux session in my desktop. Then I ssh into a server from within tmux. I want to start tmux to be able multiplex and detach from some tasks. What do?

Use ctrl+b once to send commands to local Tmux server, twice to send commands to Tmux running on remote machine you SSH'ed in to. I think this can go on, in theory, but I did not test.

Re: Tmux Tutorial

#109
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 switched to tmux because of this bug: http://savannah.gnu.org/bugs/?26723 Huh, which apparently got fixed about three years ago, after being open for seven years.

After a years in the development doldrums, Amadeusz Sławiński took over as project maintainer of GNU Screen. Since 2014, he has done sterling work: fixing bugs and adding useful features with multiple releases between then and 2017.

Re: Tmux Tutorial

#110
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've been using screen for closer to 20 years, and switched a couple of months ago. Still undecided.

My major painpoint might seem minor, but: If you're using the default ctrl+a meta in screen, and usually keep ctrl pressed when cycling through screen windows, it will take some getting used to tmux as you need to release ctrl as it will otherwise read it as another combination.

Most other stuff is configurable to your liking, though I prefer adapting to new defaults to evaluate the mindset behind the tools.

It's otherwise less different than I imagined, and I'm not sure how much you'll gain from the switch. Unless tmux gurus know a lot of cool secrets that I don't.

Post reply on HN