I am used to switching channels in Weechat by using Alt+ (Left) and Alt+ (Right). I have my Weechat instance running constantly in a tmux session on my VPS. When I feel like going on IRC, I ssh into my server, attach my tmux session and am ready to use Weechat. A pretty standard setup, I believe.

I was recently forced to switch to using Mac OS X, but I figured my workflow should not change much when it came to this particular aspect. Indeed, ssh’ing and attaching my tmux session still worked nicely and I was able to talk on IRC as usual. However, my usual way of switching channels was not working. I eventually realised this might be because of OS X using Alt+/ as a way to move your cursor an entire word, as opposed to Ctrl+/ I am used to from other systems. In the context of IRC, my channel switching takes precedence, so I wanted to change how that worked.

To achieve it, you need to change how the terminal emulator handles these key combination. For this, go to Preferences → Profiles → Keyboard. Here you have a list of key combinations and what they achieve. Find the one already linked to Alt (Option, ) + or and edit it. I prefer it this way as it already has the \033 control character in place and I am for the moment unsure how you would insert it yourself. Note that in the text field that appears, you cannot use backspace, but instead have to click the “Delete One Character”. In case the Alt+/ entries do not exist yet, you need to add it yourself with the following information: Key cursor right, Modifier option, Action send text. Finally, these are the codes that should appear in the text box that is set:

  • For Alt+, fill in \033[1;3D
  • For Alt+, fill in \033[1;3C

While this solves the channel switching issue, do keep in mind that this will likely break Alt+/ to move your cursor through words in all your terminals. In my case, it enters D and C respectively as text when I am not in Weechat. I do not currently have a cleaner solution for this.