Songs of Doom

Keybindings working with OS X and Zsh

These instructions were for Tiger - under Leopard things work much better out of the box.

This page was inspired by the helpful counterpart for Bash by desp, found at http://desp.night.pl/terminal.html; more than inspiration, I’ve clearly stolen some parts verbatim.

Things this page will help with:
Forward-delete in the terminal, instead of inserting strange characters.
Unicode support in irssi.

Configure the Terminal.app

In the “Windows Settings”:

Keyboard

Enable the Delete key sends backspace option.
Disable the Use options key as meta key option - it’s tempting as it makes Alt act as you expect, but you lose the ability to enter either £ or #, depending on your keybindings and both are pretty vital (use Escape . instead of Alt-. for example at the command prompt instead); this is not ideal and if anyone knows a better way, please let me know.

Emulation

Disable the Escape non-ASCII characters option.

Display

Set the Character Set Encoding to Unicode (UTF-8).

Configure Zsh

Insert the following code at the end of your ~/.zshrc files:

stty erase ^H
bindkey "^[[3~" delete-char
alias screen='screen -U'
set meta-flag on
set input-meta on
set output-meta on
set convert-meta off

In the above extract are two “^” codes (”^H” and “^[”), enter these not as shown, but by typing Ctrl-v, Ctrl-char; “^H” is Ctrl-v Ctrl-h and “^[” is Ctrl-v Ctrl-[.

(It’s not clear to me if the last four lines are necessary, or if they’re a throwback to the bash instructions I’ve used, if anyone knows, please tell me)

Any remote hosts will need to use a UTF $LANG, so if they’re not, put something in your ~/.zshrc like export LANG=en_GB.UTF-8.

Configure irssi

This step is clearly optional, if you don’t use irssi to connect to IRC, ignore this section.

  • Ensure that the irssi machine is configured appropriately, either with these instructions if Zsh, or the above linked instructions if Bash
  • In irssi 0.8.9 and older, /set term_type utf-8. In newer vesions, /set term_charset utf-8 (remember to /save afterwards).

2 Responses to “Keybindings working with OS X and Zsh”

Tibo wrote on November 7, 2006

this post saved me a lot of time!!!! thks a lot

iliad wrote on August 9, 2007

hi!

i cannot get it working. i did the steps in your description with the following result:

- if i call on the remote machine “screen -r” to access irssi: i cannot READ special characters written by others, others cannot READ my special characters, the prompt in irssi displays my special characters correctly

- if i call on the remote machine “screen -rU” to access irssi: i can READ special characters written by others but if i write (in the irssi prompt) special characters they are just crazy symbols.

how could i debug this problem?
- both local mac and remote linux machine use zsh shell
- you linked the bash guide which has some additional steps. i didn’t apply those. your description is complete, isn’t it?

thanks a lot for helping.

Care to comment?

Bad Behavior has blocked 822 access attempts in the last 7 days.