vim: Create dict for special chars in languages
This way it is more easily extendable. This also gives the possibility to modify it in ftplugins. I thought about removing 'de' from the dictionary in the tex.vim ftplugin to encourage using `\"a` and alike.
This commit is contained in:
@@ -51,6 +51,11 @@ augroup HighlightTrailingWhitespace
|
|||||||
au VimEnter,WinNew * call matchadd("TrailingWhitespace", '\s\+\%#\@<!$')
|
au VimEnter,WinNew * call matchadd("TrailingWhitespace", '\s\+\%#\@<!$')
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
let g:spl_special_chars = {
|
||||||
|
\ 'de': 'äöüßÄÖÜ',
|
||||||
|
\ 'fr': 'àâæçèéêëîïôœùûüÿÀÂÆÇÈÉÊËÎÏÔŒÙÛÜŸ',
|
||||||
|
\ }
|
||||||
|
|
||||||
" Highlight non-ASCII characters in the red used by my color scheme "OneDark"
|
" Highlight non-ASCII characters in the red used by my color scheme "OneDark"
|
||||||
highlight NonASCIIChars ctermfg=white guifg=white ctermbg=204 guibg=#e06c75
|
highlight NonASCIIChars ctermfg=white guifg=white ctermbg=204 guibg=#e06c75
|
||||||
" Do not highlight special characters that are valid in the respective spelllang
|
" Do not highlight special characters that are valid in the respective spelllang
|
||||||
@@ -60,12 +65,11 @@ function! HighlightNonASCIIChars()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let l:ignore_chars = '\d0-\d127'
|
let l:ignore_chars = '\d0-\d127'
|
||||||
if (&spelllang =~ '\v(^|,)de($|,)')
|
for l:spl in keys(g:spl_special_chars)
|
||||||
let l:ignore_chars ..= 'äöüßÄÖÜ'
|
if (&spelllang =~ '\v(^|,)' . l:spl . '($|,)')
|
||||||
endif
|
let l:ignore_chars ..= g:spl_special_chars[l:spl]
|
||||||
if (&spelllang =~ '\v(^|,)fr($|,)')
|
endif
|
||||||
let l:ignore_chars ..= 'àâæçèéêëîïôœùûüÿÀÂÆÇÈÉÊËÎÏÔŒÙÛÜŸ'
|
endfor
|
||||||
endif
|
|
||||||
|
|
||||||
if exists('w:ignore_non_ascii_chars')
|
if exists('w:ignore_non_ascii_chars')
|
||||||
let l:ignore_chars ..= w:ignore_non_ascii_chars
|
let l:ignore_chars ..= w:ignore_non_ascii_chars
|
||||||
|
|||||||
Reference in New Issue
Block a user