Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Good day everyone,

Seven weeks ago, I started learning Vim. I tried it in the past a lot, but this time wasn't like every instance in the past. I got it, and Vim became a habit that I can't quit. I even wrote my vimrc and I can't believe that I lived in an era where I used to use glorified notepad(s). I am by no means an expert or an intermediate level Vimmer. I am just a noob who wants to continue using Vim in his daily programming life. This sounds more romantic than pragmatic but it is the truth.

This week, I needed to edit files that contain languages other than English. It is Arabic, but the problem applies also to Hebrew and Farsi(Persian). It was a shock to me, that Vim doesn't support bidirectional text. The (not so good) solution is to have two tabs one left to right and the other right to left, but that is quit ugly in my opinion. The only editor on my machine that doesn't support bidi text is edit(The command line editor in Windows!).

Is there a solution, or should I revert back to Notepad++ and forget about Vim?

I find it hard to keep switching between Notepad++ and Vim because I edit lots of files that contain bidi text.

Thanks everyone,

share|improve this question
2  
Does :set rl not work for you? –  Paul Jul 30 '12 at 1:37

3 Answers 3

As the others answered before, Vim doesn't have BiDi support.
You can, however, get most of that functionality from emacs with evil-mode installed. Emacs supports BiDi out of the box, and evil-mode contains all of the common vim keybindings (or at least all of those I found myself using. Your mileage may vary). Just be sure to not type hebrew directly from your OS, but instead have your system set to English and change input methods inside emacs to hebrew. That is accomplished with the

M-x set-input-method

command and answering hebrew when prompted, or by adding the line

'(default-input-method "hebrew")

under custom-set-variables in your ~/.emacs file.
After either addition, you can use C-\ to switch between English and Hebrew without losing your vim-like functionality when typing in Hebrew.

I answered for Hebrew since that was the fix I needed. Obviously this all works for Arabic as well.

share|improve this answer

I also have the same problem. Ultimately the solution is to use another editor. So you can keep both editors open and both of them should be capable of auto updating when the file gets changed. Gvim is like that if set autoread is in your .vimrc file.

share|improve this answer

Vim doesn't support bi-directional text. IIRC this subject has been discussed a lot on the vim mailing lists with no advance whatsoever.

See :help hebrew and :help rileft, in which you can find this paragraph:

Bidirectionality (or bidi for short) is what Unicode offers as a full solution to these languages. Bidi offers the user the ability to view both right-to-left as well as left-to-right text properly at the same time within the same window. Vim currently, due to simplicity, does not offer bidi and is merely opting to present a functional means to display/enter/use right-to-left languages.

So I see 3 options for you:

  • go back to Notepad++
  • use the workarounds found in :help hebrew, including :set rl and :set revins
  • keep juggling between the two editors
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.