tmux-logging icon indicating copy to clipboard operation
tmux-logging copied to clipboard

Rebinding keys (MacOS)

Open diminou91 opened this issue 4 years ago • 1 comments

Hi there, I'm very new to using tmux-plugins and was wondering if you can help me either for

  • understanding why the alt key is not working (new MacOS user here, guessing the fact that alt/command key is the same makes osx listening for the next keystroke ?), or;
  • explain to me how to rebind a key from a plugin

Either way, I'm thanking you in advance for the help :)

PS : I'm using Alacritty, if that makes any difference

diminou91 avatar Aug 27 '21 14:08 diminou91

I am using the following binding to switch between windows and panes on macOS with alacritty:

  • option + [ H | J | K | L ] to navigate between panes
  • control + option + [ H | J | K | L ] to navigate between windows

I had to add a custom mapping to alacritty to be able to send the correct meta key sequence when pressing the option key on macOS:

key_bindings:
  # A workaround to be able to map the option key as meta in other programs.
  # For tmux navigation bindings.
  - { key: J,        mods: Alt,       chars: "\x1bj"                       }
  - { key: K,        mods: Alt,       chars: "\x1bk"                       }
  - { key: H,        mods: Alt,       chars: "\x1bh"                       }
  - { key: L,        mods: Alt,       chars: "\x1bl"                       }
 # For tmux-logging bindings.
  - { key: P,        mods: Alt,       chars: "\x1bp"                       }
  - { key: P,        mods: Alt|Shift, chars: "\x1bP"                       }
  - { key: C,        mods: Alt,       chars: "\x1bc"                       }

With this added, tmux can catch the default bindings defined in tmux-logging.

Source: https://github.com/alacritty/alacritty/issues/93#issuecomment-271043197

tiborsimon avatar Jul 30 '22 07:07 tiborsimon