I want to include a new highlight group and autocommand that will automatically highlight non-ASCIIs as soon as either a vimscript or a Python file is loaded in buffer (i.e. any file with filetype 'vim').
I included what follows in my ~/.vimrc:
highlight NonASCII ctermbg=Black ctermfg=Red cterm=italic " guibg=Black guifg=Red autocmd BufReadPost * if count(['vim','python'],&filetype) \ | syntax match Nonascii "[^\u0000-\u007F]" containedin=ALL \ | endif
... does not highlight anything.
I tried replacing
"[^\u0000-\u007F]" with the equivalent
"[^\d0-\d127]" without any more success.
Any help on this much welcome.
The syntax highlight group
Nonascii does show up in output of
:hi along with others I tweaked or created.
The complete content of my
~/.vimrc is available as the file
vimrc here. So is output of
:syntax in file
I created file
test.vim whose content is simply:
#!/usr/bin/vim set encoding=utf-8 scriptencoding=utf-8 set termencoding=utf-8 inoremap <C-º> <Esc> " é è ä
... then executed
$ vim -V13debug.log test.vim.
For those (as I) new to this, a good tutorial to get started with debugging vimscripts is here.