*digraph.txt* For Vim version 6.1. Last change: 2001 Sep 03
VIM REFERENCE MANUAL by Bram Moolenaar
Digraphs *digraphs**Digraphs*
Digraphs are used to enter characters that normally cannot be entered by
an ordinary keyboard. These are mostly accented characters which have the
eighth bit set. The digraphs are easier to remember than the decimal number
that can be entered with CTRL-V (see |i_CTRL-V|).
There is a brief introduction on digraphs in the user manual: |24.9|
An alternative is using the 'keymap' option.
1. Defining digraphs |digraphs-define|
2. Using digraphs |digraphs-use|
3. Default digraphs |digraphs-default|
{Vi does not have any of these commands}
1. Defining digraphs *digraphs-define**:dig**:digraphs*
:dig[raphs] show currently defined digraphs.
*E104**E39*
:dig[raphs] {char1}{char2}{number} ...
Add digraph {char1}{char2} to the list. {number} is
the decimal representation of the character.
Example:
:digr e: 235 a: 228
Avoid defining a digraph with '_' (underscore) as the
first character, it has a special meaning in the
future.
Vim is normally compiled with the |+digraphs| feature. If the feature is
disabled, the ":digraph" command will display an error message.
Example of the output of ":digraphs":
TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228
The first two characters in each column are the characters you have to type to
enter the digraph.
In the middle of each column is the resulting character. This may be mangled
if you look at it on a system that does not support digraphs or if you print
this file.
The decimal number is the number of the character.
2. Using digraphs *digraphs-use*
There are two methods to enter digraphs: *i_digraph*CTRL-K{char1}{char2} or
{char1}<BS>{char2}
The first is always available; the second only when the 'digraph' option is
set.
If a digraph with {char1}{char2} does not exist, Vim searches for a digraph
{char2}{char1}. This helps when you don't remember which character comes
first.
Note that when you enter CTRL-K{char1}, where {char1} is a special key, Vim
enters the code for that special key. This is not a digraph.
Once you have entered the digraph, Vim treats the character like a normal
character that occupies only one character in the file and on the screen.
Example:
'B' <BS> 'B' will enter the broken '|' character (166) 'a' <BS> '>' will enter an 'a' with a circumflex (226)CTRL-K '-' '-' will enter a soft hyphen (173)
The current digraphs are listed with the ":digraphs" command. Some of the
default ones are listed below |digraph-table|.
For CTRL-K, there is one general digraph: CTRL-K<Space>{char} will enter
{char} with the highest bit set. You can use this to enter meta-characters.
The <Esc> character cannot be part of a digraph. When hitting <Esc>, Vim
stops digraph entry and ends Insert mode or Command-line mode, just like
hitting an <Esc> out of digraph context. Use CTRL-V 155 to enter meta-ESC
(CSI).
If you accidentally typed an 'a' that should be an 'e', you will type 'a' <BS>
'e'. But that is a digraph, so you will not get what you want. To correct
this, you will have to type <BS> e again. To avoid this don't set the
'digraph' option and use CTRL-K to enter digraphs.
You may have problems using Vim with characters which have an ASCII value
above 128. For example: You insert ue (u-umlaut) and the editor echoes \334
in Insert mode. After leaving the Insert mode everything is fine. Note that
fmt removes all characters with ASCII codes above 128 from the text being
formatted. On some Unix systems this means you have to define the
environment-variable LC_CTYPE. If you are using csh, then put the following
line in your .cshrc:
setenv LC_CTYPE iso_8859_1