I would like vim spell to ignore words with Greek characters. Based on this question, I thought it might work to write :set spelllang+=cjk
, but that did nothing. Apparently that only works for East Asian characters. Is there a comparable setting for Greek characters?
1 Answer
I would run the following command:
syntax match greekword /\<[α-ωΑ-Ω]\+\>/ contains=@NoSpell
It makes that the words that match the pattern (i.e.: are made entirely of Greek letters) are not checked for spelling error.
If you would like to have it automatically for all the LaTeX file (filetype: tex
) you can add a dedicated syntax file to your configuration:
~/.config/nvim/after/syntax/tex.vim
With the following content:
syntax match greekword /\<[α-ωΑ-Ω]\+\>/ contains=@NoSpell
If you want to take all the Greek letters you can do:
syntax match greekwork /[\u370-\u3ff\u1d26-\u1d6a\u1dbf\u1f00-\u1ffc\u213c-\u213f\u3382-\u33bc\uab65\U1d6a8-\U1d7cb]/ contains=@NoSpell
Remark: to simplify the pattern some additional characters has been included.
-
Thank you, but this didn't work for me. Could it be because I am using
vimtex
, which does a lot of syntax highlighting and such? Commented Oct 12, 2023 at 11:09 -
-
1Yes, I just tried it again now, pasting in this exact command, and it still underlines the Greek words as if they were spelling errors. Commented Oct 12, 2023 at 18:30
-
1Can you give an example of Greek word? Are they found by the following search
/\<[α-ωΑ-Ω]\+\>
? Commented Oct 12, 2023 at 19:26 -
1I have updated the solution to take into account more Greek letters (hopefully all of them). Let me know if it works for you. Commented Oct 13, 2023 at 14:26
:help 'spelllang'
say?cjk
= Chinese Japanese Korean.