vim:aesth:highNonASCII: Support multi-spelllang
`&spelllang` can be a list of multiple languages. Support that by matching the language at the start, the end and/or between commas, instead of comparing the value, and then appending to `l:ignore_chars` for every matched language.
This commit is contained in:
@@ -58,12 +58,15 @@ function! HighlightNonASCIIChars()
|
|||||||
if exists('w:non_ascii_match_id')
|
if exists('w:non_ascii_match_id')
|
||||||
call matchdelete(w:non_ascii_match_id)
|
call matchdelete(w:non_ascii_match_id)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:ignore_chars = '\d0-\d127'
|
let l:ignore_chars = '\d0-\d127'
|
||||||
if (&spelllang == 'de')
|
if (match(&spelllang, '\v(^|,)de($|,)') != -1)
|
||||||
let l:ignore_chars ..= 'äöüß'
|
let l:ignore_chars ..= 'äöüß'
|
||||||
elseif (&spelllang == 'fr')
|
endif
|
||||||
|
if (match(&spelllang, '\v(^|,)fr($|,)') != -1)
|
||||||
let l:ignore_chars ..= 'àâæçèéêëîïôùûüœÀÂÆÇÈÉÊËÎÏÔÙÛÜŒ'
|
let l:ignore_chars ..= 'àâæçèéêëîïôùûüœÀÂÆÇÈÉÊËÎÏÔÙÛÜŒ'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let w:non_ascii_match_id = matchadd('NonASCIIChars',
|
let w:non_ascii_match_id = matchadd('NonASCIIChars',
|
||||||
\ '[^' .. l:ignore_chars .. ']')
|
\ '[^' .. l:ignore_chars .. ']')
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user