vim and arabic

in a previuos post I write about basic commands of vim, well in this post I will talk about writing arabic script in vim.
by  guess seems shell(bash) don't have problem understanding arabic, indeed I can name functions in arabic like this:

me@localhost:~$ اكتب() { echo $1; }
me@localhost:~$ اكتب ' my name is Matt '
my name is Matt

if you see arabic script as separated letters(which is the case in gnome terminal), you can try konsole which can render arabic text correctly.. to install konsole use the following command
sudo apt-get install konsole

vim can be invoked in arabic mode activated by the following command
vim -A test1
this will start with the cursor located in the right and ready for arabic text ;)

السلام عليكم

-- INSERT Arabic --

if you are using konsole, with rendering arabic (right to left languages) activated , the text above will be reversed like this           ﻢﻜﻴﻠﻋ ﻡﻼﺴﻟﺍ            thats because double rendering(one of konsole, and other for vim arabic mode) solution  make sure rendering is activated once.. either vim, or konsole.. NOT both.


as usual insertion started by pressing i not هـ, watch what you are typing .. vim commands, are in english letters.


  • Make sure arabic text rendering done once, either by vim (recommended), or your terminal if you are using terminal
  • don't mix insert mode with command mode, remember to escape and type in english for commands
  • enjoy arabic writing ;)                                                                                         

No comments:

Post a Comment