blob: b52e8f6435e4282c45f60c017ac71786a9b907e7 [file] [log] [blame]
Bram Moolenaar4421d6a2010-08-14 13:33:56 +02001*farsi.txt* For Vim version 7.3g. Last change: 2010 Aug 07
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3
4 VIM REFERENCE MANUAL by Mortaza Ghassab Shiran
5
6
7Right to Left and Farsi Mapping for Vim *farsi* *Farsi*
8
9{Vi does not have any of these commands}
10
11 *E27*
12In order to use right-to-left and Farsi mapping support, it is necessary to
13compile Vim with the |+farsi| feature.
14
15These functions have been made by Mortaza G. Shiran <shiran@jps.net>
16
17
18Introduction
19------------
20In right-to-left oriented files the characters appear on the screen from right
21to left. This kind of file is most useful when writing Farsi documents,
22composing faxes or writing Farsi memos.
23
24The commands, prompts and help files are not in Farsi, therefore the user
25interface remains the standard Vi interface.
26
27
28Highlights
29----------
30o Editing left-to-right files as in the original Vim, no change.
31
32o Viewing and editing files in right-to-left windows. File orientation is
33 per window, so it is possible to view the same file in right-to-left and
34 left-to-right modes, simultaneously.
35
36o Compatibility to the original Vim. Almost all features work in
37 right-to-left mode (see bugs below).
38
39o Changing keyboard mapping and reverse insert modes using a single
40 command.
41
42o Backing from reverse insert mode to the correct place in the file
43 (if possible).
44
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000045o While in Farsi mode, numbers are entered from left to right. Upon entering
Bram Moolenaar071d4272004-06-13 20:20:40 +000046 a none number character, that character will be inserted just into the
47 left of the last number.
48
49o No special terminal with right-to-left capabilities is required. The
50 right-to-left changes are completely hardware independent. Only
51 Farsi font is necessary.
52
53o Farsi keymapping on the command line in reverse insert mode.
54
55o Toggling between left-to-right and right-to-left via F8 function key.
56
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000057o Toggling between Farsi ISIR-3342 standard encoding and Vim Farsi via F9
58 function key. Since this makes sense only for the text written in
Bram Moolenaar071d4272004-06-13 20:20:40 +000059 right-to-left mode, this function is also supported only in right-to-left
60 mode.
61
62Farsi Fonts *farsi fonts*
63-----------
64
Bram Moolenaar33aea182010-08-07 13:19:27 +020065The following files are found in the subdirectories of the '$VIM/farsi/fonts'
66directory:
Bram Moolenaar071d4272004-06-13 20:20:40 +000067
68 + far-a01.pcf X Windows fonts for Unix including Linux systems
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000069 + far-a01.bf X Windows fonts for SunOS
Bram Moolenaar071d4272004-06-13 20:20:40 +000070 + far-a01.f16 a screen fonts for Unix including Linux systems
71 + far-a01.fon a monospaced fonts for Windows NT/95/98
72 + far-a01.com a screen fonts for DOS
73
74
75Font Installation
76-----------------
77
78o Installation of fonts for MS Window systems (NT/95/98)
79
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +000080 From 'Control Panel' folder, start the 'Fonts' program. Then from 'file'
81 menu item select 'Install New Fonts ...'. Browse and select the
Bram Moolenaar071d4272004-06-13 20:20:40 +000082 'far-a01.fon', then follow the installation guide.
83 NOTE: several people have reported that this does not work. The solution
84 is unknown.
85
86o Installation of fonts for X Window systems (Unix/Linux)
87
88 Depending on your system, copy far-a01.pcf.Z or far-a01.pcf.gz into a
89 directory of your choice. Change to the directory containing the Farsi
90 fonts and execute the following commands:
91
92 > mkfontdir
93 > xset +fp path_name_of_farsi_fonts_directory
94
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000095o Installation of fonts for X Window systems (SunOS)
Bram Moolenaar071d4272004-06-13 20:20:40 +000096
97 Copy far-a01.bf font into a directory of your choice.
98 Change to the directory containing the far-a01.fb fonts and
99 execute the following commands:
100
101 > fldfamily
102 > xset +fp path_name_of_fonts_directory
103
104o Installation of ASCII screen fonts (Unix/Linux)
105
106 For Linux system, copy the far-a01.f16 fonts into /usr/lib/kbd/consolefonts
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000107 directory and execute the setfont program as "setfont far-a01.f16". For
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108 other systems (e.g. SCO Unix), please refer to the fonts installation
109 section of your system administration manuals.
110
111o Installation of ASCII screen fonts (DOS)
112
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000113 After system power on, prior to the first use of Vim, upload the Farsi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114 fonts by executing the far-a01.com font uploading program.
115
116
117Usage
118-----
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000119Prior to starting Vim, the environment in which Vim can run in Farsi mode,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120must be set. In addition to installation of Farsi fonts, following points
121refer to some of the system environments, which you may need to set:
122Key code mapping, loading graphic card in ASCII screen mode, setting the IO
123driver in 8 bit clean mode ... .
124
125o Setting the Farsi fonts
126
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000127 + For Vim GUI set the 'guifont' to far-a01. This is done by entering
128 ':set guifont=far-a01' in the Vim window.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000129
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000130 You can have 'guifont' set to far-a01 by Vim during the Vim startup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000131 by appending the ':set guifont=far-a01' into your .vimrc file
132 (in case of NT/95/98 platforms _vimrc).
133
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000134 Under the X Window environment, you can also start Vim with the
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135 '-fn far-a01' option.
136
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000137 + For Vim within a xterm, start a xterm with the Farsi fonts (e.g.
138 kterm -fn far-a01). Then start Vim inside the kterm.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000139
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000140 + For Vim under DOS, prior to the first usage of Vim, upload the Farsi
Bram Moolenaar071d4272004-06-13 20:20:40 +0000141 fonts by executing the far-a01.com fonts uploading program.
142
143o Farsi Keymapping Activation
144
145 To activate the Farsi keymapping, set either 'altkeymap' or 'fkmap'.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000146 This is done by entering ':set akm' or ':set fk' in the Vim window.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000147 You can have 'altkeymap' or 'fkmap' set as default by appending ':set akm'
148 or ':set fk' in your .vimrc file or _vimrc in case of NT/95/98 platforms.
149
150 To turn off the Farsi keymapping as a default second language keymapping,
151 reset the 'altkeymap' by entering ':set noakm'.
152
153o right-to-left Farsi Mode
154
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000155 By default Vim starts in Left-to-right mode. Following are ways to change
Bram Moolenaar071d4272004-06-13 20:20:40 +0000156 the window orientation:
157
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000158 + Start Vim with the -F option (e.g. vim -F ...).
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000160 + Use the F8 function key to toggle between left-to-right and right-to-left.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000161
162 + While in Left-to-right mode, enter 'set rl' in the command line ('rl' is
163 the abbreviation for rightleft).
164
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000165 + Put the 'set rl' line in your '.vimrc' file to start Vim in
Bram Moolenaar071d4272004-06-13 20:20:40 +0000166 right-to-left mode permanently.
167
168Encoding
169--------
170
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000171The letter encoding used is the Vim extended ISIR-3342 standard with a built
172in function to convert between Vim extended ISIR-3342 and ISIR-3342 standard.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000173
174For document portability reasons, the letter encoding is kept the same across
175different platforms (i.e. UNIX's, NT/95/98, MS DOS, ...).
176
177
178o Keyboard
179
180 + CTRL-_ in insert/replace modes toggles between Farsi(akm)/Latin
181 mode as follows:
182
183 + CTRL-_ moves the cursor to the end of the typed text in edit mode.
184
185 + CTRL-_ in command mode only toggles keyboard mapping between Farsi(akm)/
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000186 Latin. The Farsi text is then entered in reverse insert mode.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000187
188 + F8 - Toggles between left-to-right and right-to-left.
189
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000190 + F9 - Toggles the encoding between ISIR-3342 standard and Vim extended
Bram Moolenaar071d4272004-06-13 20:20:40 +0000191 ISIR-3342 (supported only in right-to-left mode).
192
193 + Keyboard mapping is based on the Iranian ISIRI-2901 standard.
194 Following table shows the keyboard mapping while Farsi(akm) mode set:
195
196 -------------------------------------
197 ` 1 2 3 4 5 6 7 8 9 0 - =
198 ¢ ± ² ³ ´ µ ¶ · ¸ ¹ ° ­ ½
199 -------------------------------------
200 ~ ! @ # $ % ^ & * ( ) _ +
201 ~ £ § ® ¤ ¥ ª ¬ è ¨ © é «
202 -------------------------------------
203 q w e r t z u i o p [ ]
204 Ó Ò Æ Ù Ø Õ Ö à Ê É Ç ˆ
205 -------------------------------------
206 Q W E R T Z U I O P { }
207 ÷ õ ô ó ò ý ð ö [ ] { }
208 -------------------------------------
209 a s d f g h j k l ; ' \
210 Ñ Ð á Ã Ü Á Å Þ Ý Ú Û ë
211 -------------------------------------
212 A S D F G H J K L : " |
213 ù û  þ ú ø À ü æ ç º » ê
214 -------------------------------------
215 < y x c v b n m , . /
216 ¾ × Ô Î Í Ì Ë Ä ß ¦ ¯
217 -------------------------------------
218 > Y X C V B N M < > ?
219 ¼ ñ Ô Ï Í ¡ Ë Â ¾ ¼ ¿
220 -------------------------------------
221
222Note:
223 ¡ stands for Farsi PSP (break without space)
224
225 ¢ stands for Farsi PCN (for HAMZE attribute )
226
227Restrictions
228------------
229
230o In insert/replace mode and fkmap (Farsi mode) set, CTRL-B is not
231 supported.
232
233o If you change the character mapping between Latin/Farsi, the redo buffer
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000234 will be reset (emptied). That is, redo is valid and will function (using
Bram Moolenaar071d4272004-06-13 20:20:40 +0000235 '.') only within the mode you are in.
236
237o While numbers are entered in Farsi mode, the redo buffer will be reset
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000238 (emptied). That is, you cannot redo the last changes (using '.') after
Bram Moolenaar071d4272004-06-13 20:20:40 +0000239 entering numbers.
240
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000241o While in left-to-right mode and Farsi mode set, CTRL-R is not supported.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000242
243o While in right-to-left mode, the search on 'Latin' pattern does not work,
244 except if you enter the Latin search pattern in reverse.
245
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000246o In command mode there is no support for entering numbers from left
247 to right and also for the sake of flexibility the keymapping logic is
Bram Moolenaar071d4272004-06-13 20:20:40 +0000248 restricted.
249
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000250o Under the X Window environment, if you want to run Vim within a xterm
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251 terminal emulator and Farsi mode set, you need to have an ANSI compatible
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000252 xterm terminal emulator. This is because the letter codes above 128 decimal
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253 have certain meanings in the standard xterm terminal emulator.
254
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000255 Note: Under X Window environment, Vim GUI works fine in Farsi mode.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000256 This eliminates the need of any xterm terminal emulator.
257
258
259Bugs
260----
261While in insert/replace and Farsi mode set, if you repeatedly change the
262cursor position (via cursor movement) and enter new text and then try to undo
263the last change, the undo will lag one change behind. But as you continue to
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000264undo, you will reach the original line of text. You can also use U to undo all
Bram Moolenaar071d4272004-06-13 20:20:40 +0000265changes made in the current line.
266
267For more information about the bugs refer to rileft.txt.
268
269 vim:tw=78:ts=8:ft=help:norl: