arabic.txt 12 KB

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