zsh-users
 help / color / mirror / code / Atom feed
From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: utf-8 and zsh
Date: Sun, 7 Dec 2008 16:26:22 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.00.0812071600220.8543@acer> (raw)
In-Reply-To: <ghhajl$j1$1@ger.gmane.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1585 bytes --]

On Sun, 7 Dec 2008, Maurício wrote:

> Hi,
>
> Is there some zsh-specific way to enter utf-8 characters? Or should I 
> rely on my terminal to do that (xterm, mlterm etc.)?
>

There are two ZLE widgets related to entering special characters: 
insert-composed-char and insert-unicode-char

To use them, put this somewhere in your Zsh startup files:

autoload insert-composed-char
zle -N insert-composed-char
# bind it to some key (Ctrl+x in this example)
bindkey ^X insert-composed-char

autoload insert-unicode-char
zle -N insert-unicode-char
bindkey ^Y insert-unicode-char

Then, the key sequence: ^X e ' creates é, for example. See man zshall for
the full list. (search for insert-composed-char)

NB. On my system, though, it doesn't appear to be fully working (Both ^X
i ` and ^X i ' produce ì (even though the latter should produce í))

For an arbitrary Unicode point, you do:
^Y e 9 ^Y (é)
^Y 2 0 1 9 ^Y (’)
(That is: whatever-you-bound-it-to, the code in hexadecimal, then the
bound key again.)

Really, though, I've only found these useful outside of X11. Recent
things I've read say that X11 Input Methods are preferred to X11
Compose. But, I've found that Compose is what works best for me (a
native English speaker -- so, I only rarely need accented/other chars).

With Compose, for example, I can type Compose-key (which I've mapped to
'Menu'), e ', and get é. The sequences mostly seem logical (compose a e
= æ), and there are a lot of them.

(I actually made a custom keyboard map, which also puts some of the ones
I use most frequently as AltGr keys.)

Best,
Ben

  parent reply	other threads:[~2008-12-07 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-07 20:10 Maurí­cio
2008-12-07 21:14 ` Andrey Borzenkov
2008-12-07 21:26 ` Benjamin R. Haskell [this message]
2008-12-07 22:26   ` Benjamin R. Haskell
2008-12-08  6:43     ` Phil Pennock
  -- strict thread matches above, loose matches on Subject: below --
2004-03-19  0:49 Julien Palmas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.0812071600220.8543@acer \
    --to=zsh@benizi.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).