Disable spell check highlighting in Vim for Japanese and Chinese languages
I still use Vim for most of my writing and TeX preparation and over the last few years I've been doing more and more reading and writing in Japanese. Unfortunately the Vim spell check algorithm does not support Asian languages so it will just highlight any and all Japanese characters as spelling mistakes. This makes the document hard to read while editing and is just generally annoying. After digging into the documentation I found that spelllang
has an option for handling this:
set spelllang+=cjk
Combining this with what was already in my .vimrc file gave me this:
autocmd BufRead,BufNewFile *.md setlocal spell spelllang+=en_us,cjk
autocmd BufRead,BufNewFile *.txt setlocal spell spelllang+=en_us,cjk
autocmd BufRead,BufNewFile *.tex setlocal spell spelllang+=en_us,cjk
This way when a text, markdown or TeX file is opened with Japanese characters they will be ignored but spell checking for English words will still occur.