News for hackers. Stuff that matters.
Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @10:13AM (#33943833)
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 example, to seemlessly switch between panes, be they tmux panes or vim panes, I use `cmd-h`, `cmh-j`, `cmd-k`, `cmd-l`.

It's possible to achieve "command as tmux key" with iTerm which I did do for years but I don't recommend it. It's very hacky.

[0] https://github.com/christoomey/vim-tmux-navigator

Re:Getting Started with Tmux by Version467 on Sunday December 11, 2022 @10:45AM (#33944099)
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.

Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @10:54AM (#33944214)
Yes, I mentioned in another comment that I only brought up Kitty for diplomatic reasons (which was weird of me, lol). I don't really know anything about Kitty other than it's often brought up as an alternative to Alacritty. I should have just left it at Alacritty!
Re:Getting Started with Tmux by pacomerh on Wednesday December 14, 2022 @12:27AM (#33980303)
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.
Re:Getting Started with Tmux by prmoustache on Sunday December 11, 2022 @01:29PM (#33945860)
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.

Re:Getting Started with Tmux by mmmdaaa on Sunday December 11, 2022 @04:16PM (#33947615)
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 \;\
      refresh-client -S;

    bind -T off F3 \
      set -u prefix \;\
      set -u key-table \;\
      set -u status-left \;\
      set -u status-style \;\
      set -u window-status-current-style \;\
      refresh-client -S;
This way, pressing F3 in local machine disables the prefix and I can use remote tmux as if it is local. When I want to get to local tmux, I press F3 once and I am back to local tmux. I use highlighting to easily show that local prefix is disabled.
Re:Getting Started with Tmux by bakoo on Monday December 12, 2022 @04:15AM (#33952600)
Thanks, this is excellent!
Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @11:10AM (#33944388)
Reading more about Kitty now is peaking my interest. I feel like there is a reason I ignored Kitty in the past but I can't remember.
Re:Getting Started with Tmux by loloquwowndueo on Sunday December 11, 2022 @11:14AM (#33944428)
Piquing, not peaking :)
Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @11:16AM (#33944447)
lol, yes, thanks :)
Re:Getting Started with Tmux by hahajk on Sunday December 11, 2022 @11:45AM (#33944753)
For me it was the excessively minimal defaults. I also forget the exact issues, but I remember Alacrity felt usable even before editing the conf file; Kitty didn't.
Re:Getting Started with Tmux by opan on Sunday December 11, 2022 @02:52PM (#33946806)
The author has a hatred of bitmap fonts for some reason.
Re:Getting Started with Tmux by AlexSW on Sunday December 11, 2022 @11:45AM (#33944751)
For what it's worth, you can just do this using Alt (i.e. 'meta'). No special terminal required. Just use `bind -n M-<X>` to say 'no prefix' and use meta-<X>.

For example, `bind -n M-1 select-window -t 1` means Alt-1 goes to Window 1 for me.

I use Alt-h, Alt-j, Alt-k, Alt-l for vim-aware pane switching (with some vim config too), e.g. via `bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'`. I have a load of Alt-<X> mappings.

I use iTerm and Windows Terminal primarily, but it works on everything, really. Though sometimes you need to adjust what 'alt' means; in iTerm, you need to make Alt be Esc+ (I think).

Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @01:42PM (#33946025)
Meta interferes with some of my vim bindings, though, as well as some readline bindings (`alt-f`, `alt-b`). I like using the system key because it's essentially unused in Alacritty and it provides a clean separation between tools.

And actually, I didn't mention that my VinTmuxNav commands are bound to `alt-j` and the like so that I can still use `ctrl-h` and `ctrl-l` on the command line. [EDIT: ...and then alacritty binds `cmd-j` and friends to the meta version when inside vim]

And yes, can confirm you do need to make Alt be Esc+ in iTerm!

Re:Getting Started with Tmux by Scene_Cast2 on Sunday December 11, 2022 @10:19AM (#33943876)
I'm personally a fan of byobu - it moves the shortcuts to function keys.
Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @10:25AM (#33943924)
Byoby looks good, though I never use function keys. I like to keep (almost) everything as close to the homerow as possible, so I don't think I'll ever abandon tmux.

For example, to jump to specific windows within a tab, instead of number keys, I use `cmd-a`, `cmd-s`, `cmd-d`, `cmd-f`, `cmd-q`, `cmd-w`, `cmd-e`, and `cmd-r` for windows 1-8 respectively (I don't have one for 9 since if I ever get past 8 windows, they are usually throwaways).

Re:Getting Started with Tmux by trasz2 on Sunday December 11, 2022 @11:20AM (#33944500)
The main reason for having function keys is that you can have their labels on the screen, and that's intuitive. You can see it with IBM's CICS. Otherwise they are not that useful, and you can see it in eg laptops making Fn a secondary function, with the primary being adjustment of brightness or volume.
Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @11:26AM (#33944553)
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).
Re:Getting Started with Tmux by fortunateregard on Sunday December 11, 2022 @09:41PM (#33950242)
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 right side to a full traditional numpad. Typing numbers is much more seamless now. Besides numbers, other keys that always broke my flow (looking at you right curly brace) are much easier to type.

Just thought I'd share as it really elevated my overall typing/vim experience.

Re:Getting Started with Tmux by sodapopcan on Monday December 12, 2022 @11:16AM (#33956351)
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 by maleldil on Sunday December 11, 2022 @10:30AM (#33943962)
Can you elaborate on Kitty or Alacritty? I couldn't find anything. In fact, the documentation is hostile again tmux [0].

[0] https://sw.kovidgoyal.net/kitty/faq/#i-am-using-tmux-and-hav...

Re:Getting Started with Tmux by sodapopcan on Sunday December 11, 2022 @10:38AM (#33944032)
Oh my—I actually just mentioned Kitty for diplomatic reasons as some folks feel it's a friendlier alternative to Alacritty. I've personally never used it myself. Alacritty has recommended using tmux from the beginning (originally it planned to never even implementing scrollback and recommended tmux instead, but they caved and now there is native scrollback).

I believe I used this article when I switched over from iTerm to Alacritty: https://arslan.io/2018/02/05/gpu-accelerated-terminal-alacri...

Otherwise, here's my alacritty config: https://github.com/sodapopcan/dotfiles/blob/f9eba86bf292aa3b.... Line 57 is where the keybindings start (They are annoying to read since they use escape sequences). I make my tmux prefix `ctrl-space` (because `ctrl-b` is useful), then in Alacritty pressing `cmd` sends `ctrl-space` to tmux.

Re:Getting Started with Tmux by emme on Sunday December 11, 2022 @01:12PM (#33945701)
I would add foot to the list: https://github.com/DanteAlighierin/foot
Re:Getting Started with Tmux by d4rkp4ttern on Monday December 12, 2022 @04:14PM (#33960383)
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.