3

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?

2
  • What does :help 'spelllang' say?
    – romainl
    Commented Oct 12, 2023 at 9:34
  • 2
    FYI, cjk = Chinese Japanese Korean.
    – Friedrich
    Commented Oct 12, 2023 at 11:15

1 Answer 1

1

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.

13
  • 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
  • Also: I am using neovim, in case that is relevant. Commented Oct 12, 2023 at 11:17
  • 1
    Yes, 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
  • 1
    Can you give an example of Greek word? Are they found by the following search /\<[α-ωΑ-Ω]\+\>? Commented Oct 12, 2023 at 19:26
  • 1
    I 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

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.