I want non-breaking space to be immediatly highlighted when I type one in VIM, because my keyboard's layout makes me sometimes write non-breaking space instead of normal space, and then it's a hard time debugging.
I found a cool trick, entering the command :
:syntax match ErrorMsg " "
does exactly what I want (the space between quotes is a non-breaking space)
Now when I add this command to .vimrc
(without the beginning colon) it doesn't work… any idea?
May depend on how you are entering it into .vimrc
, but try:
au VimEnter,BufWinEnter * syn match ErrorMsg " "
Personally I think it would make more sense to map the typing of that space to the Space -- how often do you need to type a non-breaking space? Or maybe you can fix the issue at its source: the keyboard layout.