4

I'm starting using vim's spell check function today. But seems it treat Chinese characters as wrong spell word.

Thus I did a little research, and find I should use set spelllang=X option.

But the thing is, I don't know what's the vim abbreviation for Chinese here. I tried zh and cn, both failed.

I did some searching on google, no result, either.

Does someone know in which file, web-page or help command resides this abbreviation reference list for all languages in spelllang option?

  • 1
    I see a list of dictionaries available under vim here: ftp.vim.org/vim/runtime/spell but I don't see Chinese listed among them. – John1024 Mar 27 '15 at 5:03
  • @John1024, that's quite valuable, is there possible to make vim ignore all utf-8 code instead of treating them as wrong spelling word? – Zen Mar 27 '15 at 6:58
8

The built-in spellfile.vim script will attempt to download missing spell files from http://ftp.vim.org/vim/runtime/spell.

In general, spell checking is not supported for East Asian languages like Chinese and Japanese, because individual words are not separated by whitespace, so a different algorithm would be needed.

You probably want to

:set spelllang+=cjk

to avoid highlighting those. From :help 'spelllang':

If the name "cjk" is included East Asian characters are excluded from spell checking. This is useful when editing text that also has Asian words.

  • It's you again, life saver! – Zen Mar 27 '15 at 7:38
  • Good! +1 (it makes sense: in cjk the notion of individual word with errors is not so clear...) – JJoao Mar 27 '15 at 7:44
  • This feature seems to be pretty recent: not in 7.4.52 (Ubuntu 14.04), but in the source tree as you say. – Ciro Santilli 新疆改造中心996ICU六四事件 May 10 '15 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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