home/neovim: highlight non-ascii characters
This commit is contained in:
@@ -130,6 +130,27 @@ in {
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
match ExtraWhitespace /\s\+$/
|
||||
|
||||
" Show non-ascii characters (except norwegian æøå)
|
||||
highlight nonascii ctermbg=214 guibg=#FFA500 " orange
|
||||
function! HighlightNonAscii()
|
||||
" delete the old match if it exists
|
||||
let s:matchid = get(s:, 'matchid', -1)
|
||||
if s:matchid != -1
|
||||
try
|
||||
call matchdelete(s:matchid)
|
||||
catch /E803/
|
||||
" matchid does not exist, pass
|
||||
endtry
|
||||
endif
|
||||
" Skip popups like telescope
|
||||
if &buftype ==# ""
|
||||
let s:matchid = matchadd('nonascii', '[^\x00-\x7FæøåÆØÅ]', 100)
|
||||
else
|
||||
let s:matchid = -1
|
||||
endif
|
||||
endfunction
|
||||
autocmd BufEnter * call HighlightNonAscii()
|
||||
|
||||
" Disable search highlights
|
||||
map <Leader><Space> :noh<CR>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user