1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
*vim_rlh.txt* For Vim version 4.5. Last modification: 1996 June 11
Right to Left and Hebrew Mapping for Vim *hebrew*
========================================
These functions have been made by Avner Lottem
E-mail: lottem@tx.technion.ac.il
Phone: +972-4-8307322
Introduction
------------
In order to use right-to-left and Hebrew mapping support, it is necessary to
compile Vim with RIGHTLEFT. In right-to-left oriented files the characters
appear on the screen from right to left. This kind of file is most useful
when writing Hebrew documents using TeX--XeT, troffh, composing faxes or
writing Hebrew memos.
Logical order files, where direction is encoded for every character (or group
of characters) are not supported as this kind of support is out of the scope
of a simple addition to an existing editor. Also, no Hebrew commands, prompts
and help files were added, the standard Vi interface was maintained. The
intension here was to incorporate Hebrew support to an existing modern and
live editor, hoping that the Hebrew support will continue to live in
subsequent versions. Many other Hebrew supported packages were designed for a
particular version of the original (English) software and when it continued
developing, the Hebrew version stayed behind. Therefore this particular
support to Vim tries to be as simple (and short) as possible, so that it could
be incorporated into the official source.
Highlights
----------
o Editing left-to-right files as in the original Vim, no change.
o Viewing and editing files in right-to-left windows. File orientation
is per window, so it is possible to view the same file in right-to-left
and left-to-right modes, simultaneously.
(This is sometimes useful when editing documents with TeX--XeT.)
o Compatibility to the original Vim. Almost all features work in
right-to-left mode (see Bugs below).
o Changing keyboard mapping and reverse insert modes using a single
command.
o Backing from reverse insert mode to the correct place in the file
(if possible).
o No special terminal with right-to-left capabilities is required. The
right-to-left changes are completely hardware independent. Only
Hebrew font is necessary.
The MIT X distribution includes at least two fonts: heb6x13 and heb8x13.
Some fonts are on sunsite.unc.edu: /pub/Linux/X11/fonts/hebxfonts-0.2.tgz.
More pointers are in the Hebrew HOWTO on sunsite: /pub/Linux/docs/HOWTO.
To create a Hebrew font for a DOS box under MS-Windows, refer to a hack on
tochnapc2.technion.ac.il: /pub/lottem/doswin-0.1.tgz.
o ALL enhancements depend on a compilation variable, RIGHTLEFT,
so it is possible to compile Vim without this support.
o It should be quite easy to adjust this support to handle other right-to
left languages, such as Arabic, by simply changing the keyboard mapping
according to the character encoding.
Change details
--------------
+ Variables:
+ rightleft (rl) sets window orientation to right-to-left.
+ hkmap (hk) sets keyboard mapping to Hebrew, in insert/replace modes.
+ aleph (al), numeric, holds the decimal code of Aleph, for keyboard
mapping.
+ Encoding:
+ Under Unix, ISO 8859-8 encoding (Hebrew letters codes: 224-250).
+ Under MS DOS, PC encoding (Hebrew letters codes: 128-154).
These are defaults, that can be overided using the aleph variable.
+ Vim arguments:
+ 'vim -H file' starts editing a Hebrew file, i.e. rightleft and hkmap
are set.
+ Keyboard:
+ CTRL-_ in insert/replace modes toggles revins and hkmap as follows:
When in rightleft window, revins+nohkmap are toggled, since English
will likely be inserted in this case.
When in norightleft window, revins+hkmap are toggled, since Hebrew
will likely be inserted in this case.
CTRL-_ moves the cursor to the end of the typed text, unlike CTRL-B
that leaves the cursor in the same place.
+ CTRL-_ in command mode only toggles keyboard mapping (see Bugs below).
This setting is independent of hkmap variable, which only applies to
insert/replace mode.
Note: On some keyboards, CTRL-_ is mapped to CTRL-?.
+ Keyboard mapping while hkmap is set:
q w e r t y u i o p The characters in the mapping shown
/ ' ÷ ø à è å ï í ô here are for ISO 8859-8.
a s d f g h j k l ; '
ù ã â ë ò é ç ì ê ó ,
z x c v b n m , . /
æ ñ á ä ð î ö ú õ .
Bugs
----
o Does not handle CTRL-A and CTRL-X commands (add and subtract)
correctly when in rightleft window.
o Does not support reverse insert and rightleft modes on the command-line.
However, functionality of the editor is not reduced, because it is
possible to enter mappings, abbreviations and searches with Hebrew text,
typed from the left to the right on the command-line.
o Somewhat slower in right-to-left mode, because right-to-left motion is
emulated inside Vim, not by the controlling terminal.
o Does not support 7 bit terminals. Only a terminal with complete
Hebrew English font (without need to send escape sequences to switch
between Hebrew and English) is supported.
o When the Athena GUI is used, the bottom scrollbar works in the wrong
direction. This is difficult to fix.
o When both 'rightleft' and 'revins' are on: 'textwidth' does not work.
Lines do not wrap at all; you just get a single, long line.
Typing backwards *ins_reverse*
[for all this RIGHTLEFT must have been defined in feature.h at compile time]
If the 'revins' (reverse insert) option is set, inserting happens backwards.
This can be used to type Hebrew. When inserting characters the cursor is not
moved and the text moves rightwards. A <BS> deletes the character under the
cursor. CTRL-W and CTRL-U also work in the opposite direction. <BS>, CTRL-W
and CTRL-U do not stop at the start of insert or end of line, no matter how
the 'backspace' option is set.
In Insert mode the 'revins' option can be toggled with CTRL-B.
There is no reverse replace mode (yet).
If the 'showmode' option is set, "-- REVERSE INSERT --" will be shown in the
status line when reverse Insert mode is active.
Reverse Insert mode can be also entered via CTRL-_, which has some extra
functionality: First, keyboard mapping is changed according to the window
orientation -- if in a left-to-right window, revins is used to enter Hebrew
text, so the keyboard changes to Hebrew (hkmap is set); if in a right-to-left
window, revins is used to enter English text, so the keyboard changes to
English (hkmap is reset). Second, when exiting revins via CTRL-_, the cursor
moves to the end of the typed text (if possible).
Pasting when in a rightleft window
----------------------------------
When cutting text with the mouse and pasting it in a rightleft window
the text will be reversed, because the characters come from the cut buffer
from the left to the right, while inserted in the file from the right to
the left. In order to avoid it, toggle revins (by typing CTRL-? or CTRL-_)
before pasting.
|