Wednesday, November 28, 2018

Re: Typing Persian (Farsi) in Vim

On Wed, Nov 28, 2018 at 10:23 PM Bahman Eslami <eslami.bahman@gmail.com> wrote:
> In a case a user doesn't want to have arabic nor faris in the vim, they can build the vim with the 'normal' feature flag but they would miss other features like langmap, but if they want to build it with langmap feature, they need the 'huge' feature flag which also includes the arabic. There is also no flag to disable nor enable arabic while building the vim. So the only way to disable them is to change the source which is how I do it. Now I give you an example what goes wrong with the arabic enabled.

> I use the native terminal app in OSX which supports bidi text perfectly even when it comes to selecting text.

What is the $TERM setting when you run Console Vim (not gvim) in that
terminal? Depending on its value, there are variant ways to tell Vim
that the terminal has full-bidi capabilities:

* Possibility 1: $TERM is 'mlterm'
o Do nothing. Vim knows that mlterm is a full-bidi terminal.
* Possibility 2: $TERM is another unambiguously recognisable name,
let's say (for the sake of argument) 'system-bidi'.
o Add near the top of yout vimrc the following snippet:
if &term == 'system-bidi' && has('arabic')
set termbidi
endif
* Possibility 3: $TERM is not unambiguously recognizable, let's say it
is 'xterm' which too many fake-xterm terminals use nowadays:
o Start Vim (when running in that terminal) as:
vim --cmd 'silent! set termbidi'
If your shell supports aliases, you can define the following
alias (as I would do it for bash, which is an alias-supporting shell)
alias vim='/usr/local/bin/vim --cmd "silent! set termbidi"'
Replace /usr/local/bin/vim by the path to your Vim executable
if it is something else, of course.

> So if you take the below text sampe which contains bidi text and put it in the vim you can see that the result is correct only when the arabic is disabled. I can't say for other terminals or environments if it works correctly but any user can compare the rendering from their web browser which supports bidi text as you can see in the following line:
>
> English text متن فارسی another text
>
> So if the vim rendering of the top text example matches the rendering of your browser, then it's correct. I've also attached two sample images which one uses the vim with arabic enabled and one with arabic disabled and you can see the incorrect rendering of text using the arabic enabled. Even selecting the text is wrong with arabic enabled. I can also confirm that macvim also shows incorrect result with arabic enabled even though it's using a gui font.
>
> Best,
> Bahman

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: