arabic.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. *arabic.txt* For Vim version 9.0. Last change: 2021 Jun 22
  2. VIM REFERENCE MANUAL by Nadim Shaikli
  3. Arabic Language support (options & mappings) for Vim *Arabic*
  4. *E800*
  5. In order to use right-to-left and Arabic mapping support, it is
  6. necessary to compile Vim with the |+arabic| feature.
  7. These functions have been created by Nadim Shaikli <nadim-at-arabeyes.org>
  8. It is best to view this file with these settings within Vim's GUI: >
  9. :set encoding=utf-8
  10. :set arabicshape
  11. Introduction
  12. ------------
  13. Arabic is a rather demanding language in which a number of special
  14. features are required. Characters are right-to-left oriented and
  15. ought to appear as such on the screen (i.e. from right to left).
  16. Arabic also requires shaping of its characters, meaning the same
  17. character has a different visual form based on its relative location
  18. within a word (initial, medial, final or stand-alone). Arabic also
  19. requires two different forms of combining and the ability, in
  20. certain instances, to either superimpose up to two characters on top
  21. of another (composing) or the actual substitution of two characters
  22. into one (combining). Lastly, to display Arabic properly one will
  23. require not only ISO-8859-6 (U+0600-U+06FF) fonts, but will also
  24. require Presentation Form-B (U+FE70-U+FEFF) fonts both of which are
  25. subsets within a so-called ISO-10646-1 font.
  26. The commands, prompts and help files are not in Arabic, therefore
  27. the user interface remains the standard Vi interface.
  28. Highlights
  29. ----------
  30. o Editing left-to-right files as in the original Vim hasn't changed.
  31. o Viewing and editing files in right-to-left windows. File
  32. orientation is per window, so it is possible to view the same
  33. file in right-to-left and left-to-right modes, simultaneously.
  34. o No special terminal with right-to-left capabilities is required.
  35. The right-to-left changes are completely hardware independent.
  36. Only Arabic fonts are necessary.
  37. o Compatible with the original Vim. Almost all features work in
  38. right-to-left mode (there are liable to be bugs).
  39. o Changing keyboard mapping and reverse insert modes using a single
  40. command.
  41. o Toggling complete Arabic support via a single command.
  42. o While in Arabic mode, numbers are entered from left to right. Upon
  43. entering a none number character, that character will be inserted
  44. just into the left of the last number.
  45. o Arabic keymapping on the command line in reverse insert mode.
  46. o Proper Bidirectional functionality is possible given Vim is
  47. started within a Bidi capable terminal emulator.
  48. Arabic Fonts *arabicfonts*
  49. ------------
  50. Vim requires monospaced fonts of which there are many out there.
  51. Arabic requires ISO-8859-6 as well as Presentation Form-B fonts
  52. (without Form-B, Arabic will _NOT_ be usable). It is highly
  53. recommended that users search for so-called 'ISO-10646-1' fonts.
  54. Do an Internet search or check www.arabeyes.org for further
  55. info on where to obtain the necessary Arabic fonts.
  56. Font Installation
  57. -----------------
  58. o Installation of fonts for X Window systems (Unix/Linux)
  59. Depending on your system, copy your_ARABIC_FONT file into a
  60. directory of your choice. Change to the directory containing
  61. the Arabic fonts and execute the following commands:
  62. % mkfontdir
  63. % xset +fp path_name_of_arabic_fonts_directory
  64. Usage
  65. -----
  66. Prior to the actual usage of Arabic within Vim, a number of settings
  67. need to be accounted for and invoked.
  68. o Setting the Arabic fonts
  69. + For Vim GUI set the 'guifont' to your_ARABIC_FONT. This is done
  70. by entering the following command in the Vim window.
  71. >
  72. :set guifont=your_ARABIC_FONT
  73. <
  74. NOTE: the string 'your_ARABIC_FONT' is used to denote a complete
  75. font name akin to that used in Linux/Unix systems.
  76. (e.g. -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1)
  77. You can append the 'guifont' set command to your .vimrc file
  78. in order to get the same above noted results. In other words,
  79. you can include ':set guifont=your_ARABIC_FONT' to your .vimrc
  80. file.
  81. + Under the X Window environment, you can also start Vim with
  82. '-fn your_ARABIC_FONT' option.
  83. o Setting the appropriate character Encoding
  84. To enable the correct Arabic encoding the following command needs
  85. to be appended,
  86. >
  87. :set encoding=utf-8
  88. <
  89. to your .vimrc file (entering the command manually into your Vim
  90. window is highly discouraged). In short, include ':set
  91. encoding=utf-8' to your .vimrc file.
  92. Attempts to use Arabic without UTF-8 will result the following
  93. warning message,
  94. *W17* >
  95. Arabic requires UTF-8, do ':set encoding=utf-8'
  96. o Enable Arabic settings [short-cut]
  97. In order to simplify and streamline things, you can either invoke
  98. Vim with the command-line option,
  99. % vim -A my_utf8_arabic_file ...
  100. or enable 'arabic' via the following command within Vim
  101. >
  102. :set arabic
  103. <
  104. The two above noted possible invocations are the preferred manner
  105. in which users are instructed to proceed. Barring an enabled 'termbidi'
  106. setting, both command options:
  107. 1. set the appropriate keymap
  108. 2. enable the deletion of a single combined pair character
  109. 3. enable rightleft mode
  110. 4. enable rightleftcmd mode (affecting the command-line)
  111. 5. enable arabicshape mode (do visual character alterations)
  112. You may also append the command to your .vimrc file and simply
  113. include ':set arabic' to it.
  114. You are also capable of disabling Arabic support via
  115. >
  116. :set noarabic
  117. <
  118. which resets everything that the command had enabled without touching
  119. the global settings as they could affect other possible open buffers.
  120. In short the 'noarabic' command,
  121. 1. resets to the alternate keymap
  122. 2. disables the deletion of a single combined pair character
  123. 3. disables rightleft mode
  124. NOTE: the 'arabic' command takes into consideration 'termbidi' for
  125. possible external bi-directional (bidi) support from the
  126. terminal ("mlterm" for instance offers such support).
  127. 'termbidi', if available, is superior to rightleft support
  128. and its support is preferred due to its level of offerings.
  129. 'arabic' when 'termbidi' is enabled only sets the keymap.
  130. For vertical window isolation while setting 'termbidi' an LTR
  131. vertical separator like "l" or "𝖨" may be used. It may also be
  132. hidden by changing its color to the foreground color: >
  133. :set fillchars=vert:l
  134. :hi VertSplit ctermbg=White
  135. < Note that this is a workaround, not a proper solution.
  136. If, on the other hand, you'd like to be verbose and explicit and
  137. are opting not to use the 'arabic' short-cut command, here's what
  138. is needed (i.e. if you use ':set arabic' you can skip this section) -
  139. + Arabic Keymapping Activation
  140. To activate the Arabic keymap (i.e. to remap your English/Latin
  141. keyboard to look-n-feel like a standard Arabic one), set the
  142. 'keymap' command to "arabic". This is done by entering
  143. >
  144. :set keymap=arabic
  145. <
  146. in your Vim window. You can also append the 'keymap' set command to
  147. your .vimrc file. In other words, you can include ':set keymap=arabic'
  148. to your .vimrc file.
  149. To turn toggle (or switch) your keymapping between Arabic and the
  150. default mapping (English), it is advised that users use the 'CTRL-^'
  151. key press while in insert (or add/replace) mode. The command-line
  152. will display your current mapping by displaying an "Arabic" string
  153. next to your insertion mode (e.g. -- INSERT Arabic --) indicating
  154. your current keymap.
  155. + Arabic deletion of a combined pair character
  156. By default Vim has the 'delcombine' option disabled. This option
  157. allows the deletion of ALEF in a LAM_ALEF (LAA) combined character
  158. and still retain the LAM (i.e. it reverts to treating the combined
  159. character as its natural two characters form -- this also pertains
  160. to harakat and their combined forms). You can enable this option
  161. by entering
  162. >
  163. :set delcombine
  164. <
  165. in our Vim window. You can also append the 'delcombine' set command
  166. to your .vimrc file. In other words, you can include ':set delcombine'
  167. to your .vimrc file.
  168. + Arabic right-to-left Mode
  169. By default Vim starts in Left-to-right mode. 'rightleft' is the
  170. command that allows one to alter a window's orientation - that can
  171. be accomplished via,
  172. - Toggling between left-to-right and right-to-left modes is
  173. accomplished through ':set rightleft' and ':set norightleft'.
  174. - While in Left-to-right mode, enter ':set rl' in the command line
  175. ('rl' is the abbreviation for rightleft).
  176. - Put the ':set rl' line in your '.vimrc' file to start Vim in
  177. right-to-left mode permanently.
  178. + Arabic right-to-left command-line Mode
  179. For certain commands the editing can be done in right-to-left mode.
  180. Currently this is only applicable to search commands.
  181. This is controlled with the 'rightleftcmd' option. The default is
  182. "search", which means that windows in which 'rightleft' is set will
  183. edit search commands in right-left mode. To disable this behavior,
  184. >
  185. :set rightleftcmd=
  186. <
  187. To enable right-left editing of search commands again,
  188. >
  189. :set rightleftcmd&
  190. <
  191. + Arabic Shaping Mode
  192. To activate the required visual characters alterations (shaping,
  193. composing, combining) which the Arabic language requires, enable
  194. the 'arabicshape' command. This is done by entering
  195. >
  196. :set arabicshape
  197. <
  198. in our Vim window. You can also append the 'arabicshape' set
  199. command to your .vimrc file. In other words, you can include
  200. ':set arabicshape' to your .vimrc file.
  201. Keymap/Keyboard *arabickeymap*
  202. ---------------
  203. The character/letter encoding used in Vim is the standard UTF-8.
  204. It is widely discouraged that any other encoding be used or even
  205. attempted.
  206. Note: UTF-8 is an all encompassing encoding and as such is
  207. the only supported (and encouraged) encoding with
  208. regard to Arabic (all other proprietary encodings
  209. should be discouraged and frowned upon).
  210. o Keyboard
  211. + CTRL-^ in insert/replace mode toggles between Arabic/Latin mode
  212. + Keyboard mapping is based on the Microsoft's Arabic keymap (the
  213. de facto standard in the Arab world):
  214. +---------------------------------------------------------------------+
  215. |! |@ |# |$ |% |^ |& |* |( |) |_ |+ || |~ ّ |
  216. |1 ١ |2 ٢ |3 ٣ |4 ٤ |5 ٥ |6 ٦ |7 ٧ |8 ٨ |9 ٩ |0 ٠ |- |= |\ |` ذ |
  217. +---------------------------------------------------------------------+
  218. |Q َ |W ً |E ُ |R ٌ |T لإ |Y إ |U ` |I ÷ |O x |P ؛ |{ < |} > |
  219. |q ض |w ص |e ث |r ق |t ف |y غ |u ع |i ه |o خ |p ح |[ ج |] د |
  220. +-----------------------------------------------------------+
  221. |A ِ |S ٍ |D [ |F ] |G لأ |H أ |J ـ |K ، |L / |: |" |
  222. |a ش |s س |d ي |f ب |g ل |h ا |j ت |k ن |l م |; ك |' ط |
  223. +------------------------------------------------------+
  224. |Z ~ |X ْ |C { |V } |B لآ |N آ |M ' |< , |> . |? ؟ |
  225. |z ئ |x ء |c ؤ |v ر |b لا |n ى |m ة |, و |. ز |/ ظ |
  226. +-------------------------------------------------+
  227. Restrictions
  228. ------------
  229. o Vim in its GUI form does not currently support Bi-directionality
  230. (i.e. the ability to see both Arabic and Latin intermixed within
  231. the same line).
  232. Known Bugs
  233. ----------
  234. There is one known minor bug,
  235. 1. If you insert a haraka (e.g. Fatha (U+064E)) after a LAM (U+0644)
  236. and then insert an ALEF (U+0627), the appropriate combining will
  237. not happen due to the sandwiched haraka resulting in something
  238. that will NOT be displayed correctly.
  239. WORK-AROUND: Don't include harakats between LAM and ALEF combos.
  240. In general, don't anticipate to see correct visual
  241. representation with regard to harakats and LAM+ALEF
  242. combined characters (even those entered after both
  243. characters). The problem noted is strictly a visual
  244. one, meaning saving such a file will contain all the
  245. appropriate info/encodings - nothing is lost.
  246. No other bugs are known to exist.
  247. vim:tw=78:ts=8:noet:ft=help:norl: