Yakov Lerner wrote:
On 9/25/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:
On 9/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hello everyone.
>
> The spell-check in Vim7 seems wonderful, several weeks ago I've been
> challenged to do spellcheck for files which contain both English and
> Chinese text. I failed to do that.
>
> The problem is that if the spell-check turned on, ALL chinese text are
> marked as spell error and it might be difficult to see where the real spell
> error is.
>
> Chinese text do not need spell check at all since all chinese characters
> are valid words, we do want to check English text only. Note that the
> target file may also be a C program and we may want to spell check the
> comment.
>
> One solution may be add all chinese characters into spell dictionary but
> that seems to be crazy and the dictionary would be huge.
>
> Is it possible to do spell-check only for ascii character and just ignore
> the double-width character?

One solution, I think,  is to prepare the primitive syntaxfile
that matches all Chinese chars with a syntax highlight group
labeled with [EMAIL PROTECTED] Supposedly chinese chars
all have codes above 256 and english chars have codes below that,
or below z.

Assuming that max codepoint is 0xFFFF , you can try
   exe 'syn match Normal /['.nr2char(256).'-'.nr2char(0xFFFF).']/
[EMAIL PROTECTED]'
or
   exe 'syn match Chinese /['.nr2char(256).'-'.nr2char(0xFFFF).']/
[EMAIL PROTECTED]'

In the latter, you can also give Chinese chars gray color when
spellchecking English, so as to make it clear that those regions are
not spellchecked.

Yakov


Max range is currently U+2FA1D in practice, U+2FA1F in theory; but as I said a few minutes ago, that range won't be accepted (not even with upper bound set to U+FFFF).


Best regards,
Tony.

Reply via email to