1

It is an old issue, that Vim is not able to correctly display Devanagari (Sanskrit) ligatures as it is non GUI (emacs, gedit do well). In different forums it was discussed in the past (mostly before Neovim).

It is not a matter of "language" or "fonts" settings. The letters are displayed, but the ligatures are not correct. Additional the vim-bindings do not function well with this script.

My question: are there any new ways to edit Devanagari-script with Neovim e.g. a GUI-plugin?

7
  • Was that before the 'guiligatures' patch was included with vim? Jun 29, 2023 at 12:22
  • Do you talk about this patch: github.com/gasparch/vim8-ligatures-package? I do not know this. So that might help. Should I install? Or is this already included? I have the latest version of vim and neovim.
    – Denis
    Jun 29, 2023 at 12:50
  • yeah, I think a later version of this patch has been included with vim. See :h 'guiligatures' Jun 29, 2023 at 13:14
  • So they write in ':h guiligatures', that it is only for GTK GUI. So I guess, terminal-based I can forget it. Am I right? But I will try that.
    – Denis
    Jun 29, 2023 at 20:16
  • They differentiate in ':h guiligatures' between string vs. global option. What does that mean?
    – Denis
    Jun 29, 2023 at 20:18

1 Answer 1

1

Finally I found a solution, which I described here. So it is a matter of the right terminal and the right font configured there.

Vim is not able to recognize the sanskrit words as words. So when I move through the text with e.g. 'w', 'e' or 'b' the behaviour is unpredictable. Sometimes the cursor arrives in the middle of the word. For my needs that should be no problem. I will see what happens, when I work with vim-macros. Working mainly with LaTeX, I solve this with creating a \newcommand for each Sanskrit stanza in a separate file. So in the main file I do not have to work with ligatures.


Update - Jul 5 2023

After a few days of test phase I give a short update. It is not a perfect solution, but better what I had before.

I work with kitty as a terminal and in the ~/.config/kitty/kitty.conf I changed the fonts to DejaVu Sans Mono.

Kitty has a function to specify special fonts for particular characters. I tried to change with symbol_map U+900-U+097F Sanskrit 2003 according to the Sanskrit Unicodes. Interestingly the output is nicer with a global DejaVu Sans Mono than with special fonts. Might be this is because Sanskrit 2003 fonts is not an official font of kitty (kitty +list-fonts lists only: SourceCodeVF, Source Code Pro, Nimbus Mono PS, Liberation Mono, Iosevka Term, DejaVu Sans Mono and Bitstream Vera Sans Mono). Maybe it is possible to include more fonts into kitty?

So with Kitty and DejaVu Sans Mono I got the best results with the output. So the "display-issue" I have solved. But still I cannot edit the Sanskrit-Ligatures the proper way:

Typing with fcitx5

When I import the ligatures from a Devanagari-Engine like Sanscript I have nice results. When I try to typ myself with fcitx5 the ligatures are not formed proper and the words become "splitted". Maybe I have to try fcitx5-gtk?

Editing with Vim commands

Editing with Vim commands is difficult because the fonts too become sometimes "splitted" and Vim does not recognize the ligatures as a word. A bit tricky.

So I still avoid to edit the ligatures as much as possible in Vim. I created for the use with ´tex` some .sty-files with macros of the Sanskrit stanzas which I include into the many document.

The trial with GUI neovimgtk was no success.

Any hints for improvement are welcome.

2
  • Glad you found a solution! It would be good if you could include the details in your answer here instead of (or as well as) the link to your answer elsewhere.
    – Rich
    Jul 4, 2023 at 23:39
  • 1
    I wrote an update. Maybe I was a bit too enthusiastic in the beginning. Still not perfect, but better than before.
    – Denis
    Jul 5, 2023 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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