by sodapopcan · 3y ago · 0 comments
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.
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.
Running remote tmux inside a local tmux is just to error prone and forces you to remember different bindings.
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.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).
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!
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).
[0] https://sw.kovidgoyal.net/kitty/faq/#i-am-using-tmux-and-hav...
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.