Typing Persian (Farsi) in Vim

1,128 views
Skip to first unread message

Ali Majdzadeh

unread,
Dec 25, 2007, 8:20:37 AM12/25/07
to vim_use
Hello All
I want to type Persian in Vim, under both Windows and Linux. Could
anyone please help me? By the way, I use the console version of Vim.

Best Regards
Ali

Tony Mechelynck

unread,
Dec 25, 2007, 11:54:27 AM12/25/07
to vim...@googlegroups.com

With the console version, it may or may not be possible to _display_ Persian
characters, depending on the underlying terminal. For "strange" writing
systems, or for any mixing of several writing systems (such as Arabic
[including Persian], Hebrew, Nagari, Chinese ideograms [for Chinese, Japanese
and/or South Korean], kana [for Japanese], hangeul [for South and North
Korean] and others, as well as any variant of Latin, in any combination), I
recommend using gvim (which frees you from any constraints imposed by a
terminal console, and lets you work identically on any platform) and UTF-8
(which allows, in a single character encoding, all writing systems known to man).

See:
:help farsi.txt
:help arabic.txt
http://vim.wikia.com/wiki/Working_with_Unicode
http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI
http://www.vim.org/scripts/script.php?script_id=789
(Switching to Unicode in an orderly manner)

The only advantage of running in a console would be if it were a "true bidi"
terminal, handling, outside of Vim, the display of mixed left-to-right and
right-to-left character strings on the same line (and the strange cursor moves
that that implies), as well as Arabic "presentation forms" (i.e., the
characters changing shape according to their position in a word); see
:help 'termbidi'

For entering characters not on your keyboard, see:
:help i_CTRL-V_digit
:help digraph.txt
:help mbyte-keymap
If your locale is non-Latin, you may also have a look at
:help 'langmap'

You may also (if the existing keymaps are not to your liking) write your own
keymap, as I did twice for my private use, one for Russian and one for Arabic
(these keymaps of mine probably use too much dead keys for general
consumption, but they are more suited to my "form of memory" and to my Latin
fr_BE keyboard than those available with Vim).

See:
:help keymap-file-format
http://vim.wikia.com/wiki/How_to_make_a_keymap


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
183. You move your coffeemaker next to your computer.

Ali Majdzadeh

unread,
Dec 26, 2007, 3:40:23 AM12/26/07
to vim...@googlegroups.com
Tony,
Thanks for your attention. I will try what you said.
Thanks again.

Kind Regards
Ali

2007/12/25, Tony Mechelynck < antoine.m...@gmail.com>:

Felipe Vieira

unread,
Apr 29, 2018, 10:49:40 PM4/29/18
to vim_use
Hey guys,

I have tried the above solution and the following:

http://vim.1045645.n5.nabble.com/arabic-font-td1161759.html

Still can't get Farsi to work. I get those "<200d>" characters.

I have tried gvim with

:set guifont=Courier\ New\ 10

For instance.

Website for example:

http://www.unics.uni-hannover.de/nhtcapri/persian-alphabet.html

It displays nicely on my firefox.

Bram Moolenaar

unread,
Apr 30, 2018, 3:58:54 AM4/30/18
to vim...@googlegroups.com, Felipe Vieira
The Farsi support in Vim is outdated. It doesn't work with Unicode.
We are waiting for someone to re-implement it, or merge it with the
Arabic support.

--
Eight Megabytes And Continually Swapping.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Bahman Eslami

unread,
Nov 27, 2018, 4:28:03 PM11/27/18
to vim_use
I also wonder why there is no option to disable farsi or arabic on vim compile. The terminal I use supports bidi text, so in order to build the vim correctly for my terminal, I have to change config and features file in the source to disable farsi and arabic, which is inconvenient if I want to keep updating the vim.

Thanks,
Bahman

Christian Brabandt

unread,
Nov 27, 2018, 4:29:50 PM11/27/18
to vim_use

On Di, 27 Nov 2018, Bahman Eslami wrote:

>
> I also wonder why there is no option to disable farsi or arabic on vim
> compile. The terminal I use supports bidi text, so in order to build
> the vim correctly for my terminal, I have to change config and
> features file in the source to disable farsi and arabic, which is
> inconvenient if I want to keep updating the vim.

If you can create a patch that makes this feature configurable via a
configure switch, I am pretty sure this would be appreciated.

Best,
Christian
--
Ich sei, gewährt mir die Bitte, in eurem Bunde der Dritte.
-- Friedrich Johann Christoph Schiller (Die Bürgschaft)

Bram Moolenaar

unread,
Nov 27, 2018, 5:17:49 PM11/27/18
to vim...@googlegroups.com, Bahman Eslami

> On Monday, April 30, 2018 at 9:58:54 AM UTC+2, Bram Moolenaar wrote:
> > Felipe Vieira wrote:
> >
> > > I have tried the above solution and the following:
> > >
> > > http://vim.1045645.n5.nabble.com/arabic-font-td1161759.html
> > >
> > > Still can't get Farsi to work. I get those "<200d>" characters.
> > >
> > > I have tried gvim with
> > >
> > > :set guifont=Courier\ New\ 10
> > >
> > > For instance.
> > >
> > > Website for example:
> > >
> > > http://www.unics.uni-hannover.de/nhtcapri/persian-alphabet.html
> > >
> > > It displays nicely on my firefox.
> >
> > The Farsi support in Vim is outdated. It doesn't work with Unicode.
> > We are waiting for someone to re-implement it, or merge it with the
> > Arabic support.
>
> I also wonder why there is no option to disable farsi or arabic on vim
> compile. The terminal I use supports bidi text, so in order to build
> the vim correctly for my terminal, I have to change config and
> features file in the source to disable farsi and arabic, which is
> inconvenient if I want to keep updating the vim.

What do you mean? There are both options and features to enable/disable
Arabic and Farsi. E.g. there is FEAT_ARABIC and the 'arabic' option.

--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~

Bahman Eslami

unread,
Nov 27, 2018, 7:01:00 PM11/27/18
to Bram Moolenaar, vim...@googlegroups.com


On 27 Nov 2018, at 23:17, Bram Moolenaar <Br...@moolenaar.net> wrote:


On Monday, April 30, 2018 at 9:58:54 AM UTC+2, Bram Moolenaar wrote:
Felipe Vieira wrote:

I have tried the above solution and the following:

http://vim.1045645.n5.nabble.com/arabic-font-td1161759.html

Still can't get Farsi to work. I get those "<200d>" characters.

I have tried gvim with

   :set guifont=Courier\ New\ 10

For instance.

Website for example:

http://www.unics.uni-hannover.de/nhtcapri/persian-alphabet.html

It displays nicely on my firefox.

The Farsi support in Vim is outdated.  It doesn't work with Unicode.
We are waiting for someone to re-implement it, or merge it with the
Arabic support.

I also wonder why there is no option to disable farsi or arabic on vim
compile. The terminal I use supports bidi text, so in order to build
the vim correctly for my terminal, I have to change config and
features file in the source to disable farsi and arabic, which is
inconvenient if I want to keep updating the vim.

What do you mean?  There are both options and features to enable/disable
Arabic and Farsi.  E.g. there is FEAT_ARABIC and the 'arabic' option.


I mean while compiling there is no flag for disabling ‘farsi' or ‘arabic'. I know I can change the source code for FEAT_ARABIC (which is how I do it now) but that’s not the way to go for long run in a case vim gets updated. The reason I want to disable them using flags is because I use the ‘huge' flag for building the vim from the source. Actually someone suggested this flag a year ago using a patch but it didn’t went through:


I think adding the disable flag for these features would be helpful since many text engines do the bidi rendering nowadays and enabling these features is just useless and for my case destructive.

Bahman


Bram Moolenaar

unread,
Nov 28, 2018, 2:39:04 PM11/28/18
to vim...@googlegroups.com, Bahman Eslami

Bahman Eslami wrote:

> > On 27 Nov 2018, at 23:17, Bram Moolenaar <Br...@moolenaar.net> wrote:
> >
> >>
> >> On Monday, April 30, 2018 at 9:58:54 AM UTC+2, Bram Moolenaar wrote:
> >>> Felipe Vieira wrote:
> >>>
> >>>> I have tried the above solution and the following:
> >>>>
> >>>> http://vim.1045645.n5.nabble.com/arabic-font-td1161759.html
> >>>>
> >>>> Still can't get Farsi to work. I get those "<200d>" characters.
> >>>>
> >>>> I have tried gvim with
> >>>>
> >>>> :set guifont=Courier\ New\ 10
> >>>>
> >>>> For instance.
> >>>>
> >>>> Website for example:
> >>>>
> >>>> http://www.unics.uni-hannover.de/nhtcapri/persian-alphabet.html
> >>>>
> >>>> It displays nicely on my firefox.
> >>>
> >>> The Farsi support in Vim is outdated. It doesn't work with Unicode.
> >>> We are waiting for someone to re-implement it, or merge it with the
> >>> Arabic support.
> >>
> >> I also wonder why there is no option to disable farsi or arabic on vim
> >> compile. The terminal I use supports bidi text, so in order to build
> >> the vim correctly for my terminal, I have to change config and
> >> features file in the source to disable farsi and arabic, which is
> >> inconvenient if I want to keep updating the vim.
> >
> > What do you mean? There are both options and features to enable/disable
> > Arabic and Farsi. E.g. there is FEAT_ARABIC and the 'arabic' option.
> >
>
> I mean while compiling there is no flag for disabling ‘farsi' or ‘arabic'. I know I can change the source code for FEAT_ARABIC (which is how I do it now) but that’s not the way to go for long run in a case vim gets updated. The reason I want to disable them using flags is because I use the ‘huge' flag for building the vim from the source. Actually someone suggested this flag a year ago using a patch but it didn’t went through:
>
> https://github.com/vim/vim/pull/1867 <https://github.com/vim/vim/pull/1867>

That patch has slipped down in the todo list, I'll move it up a bit.

> I think adding the disable flag for these features would be helpful
> since many text engines do the bidi rendering nowadays and enabling
> these features is just useless and for my case destructive.

I don't see how disabling the feature at build time is required. If you
don't set 'arabic' then that is the same, right? If not, please explain
what goes wrong with just building with FEAT_ARABIC.

--
There are only two hard things in programming: Cache invalidation,
naming things and off-by-one errors.

Bahman Eslami

unread,
Nov 28, 2018, 4:23:45 PM11/28/18
to vim_use
Hey Bram,

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. 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

vim-without-arabic-in-osx-terminal.png
vim-with-arabic-in-osx-terminal.png

Bahman Eslami

unread,
Nov 28, 2018, 4:49:10 PM11/28/18
to vim...@googlegroups.com
I also have to add iTerm in OSX doesn’t support bidi text (see this), so bidi text in vim, with or without ‘arabic’ or ‘farsi’ feature will be rendered incorrectly. I suppose this goes for other environments where the bidi text is not supported. But of course I can’t confirm it since I don’t use Windows or Linux.

Best,
Bahman

-- 
-- 
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<vim-without-arabic-in-osx-terminal.png><vim-with-arabic-in-osx-terminal.png>

Tony Mechelynck

unread,
Nov 28, 2018, 5:04:29 PM11/28/18
to vim...@googlegroups.com
On Wed, Nov 28, 2018 at 10:23 PM Bahman Eslami <eslami...@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.

Bahman Eslami

unread,
Nov 28, 2018, 5:19:55 PM11/28/18
to vim_use
On Wednesday, November 28, 2018 at 11:04:29 PM UTC+1, Tony Mechelynck wrote:
> On Wed, Nov 28, 2018 at 10:23 PM Bahman Eslami <eslami...@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.

Tony,

Thanks for the explanation. When I echo the $TERM in vim I get: xterm-256color. So I used your solution to add 'set termbidi' with the vim build that includes the arabic feature but I still get incorrect Arabic shaping. I also get very abnormal behavior. If I type the following text or even paste it:

نوتشن فارسی

I get the following result in vim, which even in length does not match the input:

?~F?~Hشت?~F ?~Aارس?~L

I guess it didn't do much for my case.

Thanks,
Bahman

Gary Johnson

unread,
Nov 28, 2018, 5:35:59 PM11/28/18
to vim_use
On 2018-11-28, Bahman Eslami 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.

Not true. You can use the environment variable CFLAGS to enable
features for which there is not a configure option. For example,
I don't need all the features in the huge build, but I do want
+conceal and +mouse_sgr, so I execute these before configuring:

$ export CONF_OPT_FEAT='--with-features=normal'
$ export CFLAGS='-DFEAT_CONCEAL -DFEAT_MOUSE_SGR'

You might be able to use -U to disable a feature, but I don't know
how the configure and make commands prioritize conflicting settings
and I haven't tried that.

Regards,
Gary

Tony Mechelynck

unread,
Nov 28, 2018, 6:48:30 PM11/28/18
to vim...@googlegroups.com
Weird. My guess is that there is an encoding misunderstanding, but I
could be wrong about that. AFAIK, the +arabic feature works best when
Vim uses UTF-8 'encoding'. Try adding the following (with the
comments, meant to help you understand it even later on) near the top
of your vimrc:

if has('multi_byte')
if &enc !~? '^u'
if &tenc == ""
let &tenc = &enc
endif
set enc=utf-8
endif
scriptencoding utf-8 " see note 1
" set fencs=ucs-bom,utf-8,default,latin1 " see note 2
setg fenc=utf-8
" setg bomb " see note 3
endif
" Notes:
" 1. :scriptencoding utf-8 means that this vimrc is encoded in UTF-8.
" Anything in ASCII is expressed byte-by-byte identically in
" UTF-8 anyway. The difference is only felt when using
" characters not present in Latin1 or characters whose Latin1
" representation is > 0x7F.
" 2. 'fileencodings' (plural) defines the heuristic used when opening
" an existing file. The value (commented-out) here is Vim's
" Unicode default. Other values can be used depending on
" the language(s) used most on this installation. The actual
" value used should start with "ucs-bom,utf-8" in that order,
" and the last comma-separated field (and _only_ the last one)
" should be an 8-bit charset, which will be used as fallback if
" everything else fails.
" 3. :setg bomb sets the default 'bomb' setting to TRUE when
" creating a new Unicode file. It has its pluses and minuses.
" If the other settings above work the way they should,
" we can try uncommenting that line to see if we prefer
" running Vim with or without it.


Best regards,
Tony.

Bram Moolenaar

unread,
Nov 29, 2018, 5:31:36 PM11/29/18
to vim...@googlegroups.com, Bahman Eslami
You are missing something. You can build Vim with the Arabic and/or
Farsi feature, but so long as you don't set the 'arabic' or 'fkmap'
options then nothing should be different. You haven't answered the
question why anything changes without setting those options. I always
build with huge features and don't get any Arabic stuff because it's not
enabled by the option.


--
"I know that there are people who don't love their fellow man,
and I hate those people!" - Tom Lehrer

Tony Mechelynck

unread,
Nov 29, 2018, 7:00:32 PM11/29/18
to vim...@googlegroups.com, eslami...@gmail.com
On Thu, Nov 29, 2018 at 11:31 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
> You are missing something. You can build Vim with the Arabic and/or
> Farsi feature, but so long as you don't set the 'arabic' or 'fkmap'
> options then nothing should be different. You haven't answered the
> question why anything changes without setting those options. I always
> build with huge features and don't get any Arabic stuff because it's not
> enabled by the option.

IIUC, the OP's problem is that mixed RTL and LTR text is not displayed
in full-bidi in Vim (which is a known limitation, but he regards it as
a major bug) but that the Mac native terminal, which calls itself
xterm-256color and not mlterm, displays full-bidi even in Vim, with
correct shaping of Arabic letters, provided that Vim is compiled with
-arabic. (I don't know how it does that, but I'm not on a Mac myself.)
"set termbidi" (which requires +arabic) apparently corrupts the
display, as shown in one of his posts earlier in this thread.

Best regards,
Tony.

Bahman Eslami

unread,
Dec 1, 2018, 12:48:18 AM12/1/18
to Tony Mechelynck, vim...@googlegroups.com
Hello,

Sorry for late reply and also taking your time on this,

Tony:
I added the configuration as you mentioned. After that when I typed Persian everything got typed as question marks and still as before every character I typed resulted in more than one character. So I still prefer to have the feature ‘arabic’ and ‘persian’ off. Sorry but thanks!

Bram:
Maybe I didn't understand you question correctly? I cloned the vim from GitHub and without any changes to the source if I build it using the ‘huge’ feature, it includes +arabic and +farsi. Even if I use homebrew to install it I get those features. According to this vim includes ‘farsi' and ‘arabic' in the ‘huge' features. I don’t explicitly add ‘arabic’ nor ‘farsi’ since I don’t know how it’s done without changing the feature and config file in the src. I hope this answered the question.

Here is the output from my vim —version installed using Homebrew without any options, just by using 'brew install vim':

VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov 24 2018 19:13:03)
macOS version
Included patches: 1-500
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     +tag_old_static
+arabic            +farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl              +vartabs
+clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           -python            +viminfo
+conceal           +linebreak         +python3           +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       +lua               +ruby              +writebackup
+dialog_con        +menu              +scrollbind        -X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       -xim
-dnd               +mouse             +startuptime       -xpm
-ebcdic            -mouseshape        +statusline        -xsmp
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_clipboard
+eval              -mouse_gpm         +syntax            -xterm_save
+ex_extra          -mouse_jsbterm     +tag_binary        
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.5.3 -lobjc    


I have to say the reason I chose vim is its performance and extensibility plus ability to type RTL without hassle which is extremely rare. So I was very excited to see that RTL works in the OSX terminal out of the box.

Best,
Bahman

Bram Moolenaar

unread,
Dec 1, 2018, 5:50:28 AM12/1/18
to vim...@googlegroups.com, Bahman Eslami, Tony Mechelynck

Bahman Eslami wrote:

> Sorry for late reply and also taking your time on this,
>
> Tony:
> I added the configuration as you mentioned. After that when I typed Persian everything got typed as question marks and still as before every character I typed resulted in more than one character. So I still prefer to have the feature ‘arabic’ and ‘persian’ off. Sorry but thanks!
>
> Bram:
> Maybe I didn't understand you question correctly? I cloned the vim
> from GitHub and without any changes to the source if I build it using
> the ‘huge’ feature, it includes +arabic and +farsi. Even if I use
> homebrew to install it I get those features. According to this
> <http://www.drchip.org/astronaut/vim/vimfeat.html> vim includes
> ‘farsi' and ‘arabic' in the ‘huge' features. I don’t explicitly add
> ‘arabic’ nor ‘farsi’ since I don’t know how it’s done without changing
> the feature and config file in the src. I hope this answered the
> question.

Yes, I understand that your Vim is build with +arabic and +farsi. That
is fine, I also build with these features.

The question is: When Vim has these features, what is different from a
Vim without these features? Both Vim binaries should do exactly the
same thing, unless you set options such as 'arabic' and 'fkmap'. Are
these options set automatically for you perhaps? Try this:

verbose set arabic? fkmap?

Or just try disabling them:

verbose set noarabic norightleft nofkmap


--
LETTERS TO THE EDITOR (The Times of London)

Dear Sir,

I am firmly opposed to the spread of microchips either to the home or
to the office.  We have more than enough of them foisted upon us in
public places.  They are a disgusting Americanism, and can only result
in the farmers being forced to grow smaller potatoes, which in turn
will cause massive unemployment in the already severely depressed
agricultural industry.

Yours faithfully,
        Capt. Quinton D'Arcy, J. P.
        Sevenoaks

Bahman Eslami

unread,
Dec 1, 2018, 9:40:56 PM12/1/18
to Bram Moolenaar, vim...@googlegroups.com, Tony Mechelynck
Bram and Tony,

I found the problem! :) In short the solution was to 'set termbidi' in the vimrc file and I had to remove any vim configuration files and folders. Previously my vim was acting so strangely when I built it using brew and was typing Persian and it was inserting question marks. To fix it I deleted the .vim folder and and also the .vimrc file and build the vim from scratch. So I got a fresh vim install, then I started to try the solutions Tony described, because what you said made me realise I was doing something different from you. So the problem I guess was vim not recognising the terminal. Now it’s working great just like I expect it when I ’set termbidi’ in the vimrc file. I couldn’t make it work in the iTerm though which is not a bidi terminal. Sorry for taking you time again. 

Thanks a lot,
Bahman

Tony Mechelynck

unread,
Dec 1, 2018, 10:06:43 PM12/1/18
to Bahman Eslami, Bram Moolenaar, vim...@googlegroups.com
On Sun, Dec 2, 2018 at 3:40 AM Bahman Eslami <eslami...@gmail.com> wrote:
>
> Bram and Tony,
>
> I found the problem! :) In short the solution was to 'set termbidi' in the vimrc file and I had to remove any vim configuration files and folders. Previously my vim was acting so strangely when I built it using brew and was typing Persian and it was inserting question marks. To fix it I deleted the .vim folder and and also the .vimrc file and build the vim from scratch. So I got a fresh vim install, then I started to try the solutions Tony described, because what you said made me realise I was doing something different from you. So the problem I guess was vim not recognising the terminal. Now it’s working great just like I expect it when I ’set termbidi’ in the vimrc file. I couldn’t make it work in the iTerm though which is not a bidi terminal. Sorry for taking you time again.

Indeed, full-bidi (e.g. displaying on the same line Arabic-script text
in RTL direction and Latin-script text in LTR) is not possible in Vim
alone, even if compiled with +rightleft and +arabic, it needs
cooperation of a full-bidi-capable terminal, and it needs to know that
the terminal can display full-bidi text (the latter is the /raison
d'être/ of the 'termbidi' option). When Vim is not running in a
full-bidi terminal, it can display all text in either LTR or RTL, even
both in /different/ windows displaying the same file, but not both in
the same window. I'm happy to know that you finally made it work.
>
> Thanks a lot,
> Bahman

You're welcome, and Best regards,
Tony.
Reply all
Reply to author
Forward
0 new messages