Get Weechat meta keybinding to work on a Mac

I recently began using Weechat as my IRC client on Ubuntu. I typically work on an OSX laptop and use Terminal to SSH into my Ubuntu workstation where I keep weechat running in a tmux session. This works great, but I had trouble getting META keybindings to work.

I wanted to use the option ⌥ + ↑ / ↓ arrow keys to navigate jump between windows. These commands will add those keybindings to weechat:

/key bind meta-A /window up
/key bind meta-B /window down

However after adding these bindings it still didn’t work for me. After some exploration I discovered Terminal needed to be configured to send the expected the key codes when pressing the option key. I manually added these by opening “Terminal > Preferences… > Profiles > Keyboard” and adding the following entries into Terminal’s Key/Action table:

Key: Cursor Up
Modifier: Option
Action: Send Text
input: \033A (enter this by typing the Esc key, then shift+A)
Key: Cursor Down
Modifier: Option
Action: Send Text
input: \033B (enter this by typing the Esc key, then shift+B)

And this solved the problem!

Note: selecting “Use option as meta key” did not have any impact on this scenario.

Leave a Reply

Your email address will not be published. Required fields are marked *