I got these two autocmd config in my .vimrc
autocmd FileType python highlight OverLength ctermbg=red ctermfg=white guibg=red
autocmd FileType python match OverLength /\%80v.\+/
autocmd FileType python highlight ExtraWhitespace ctermbg=blue guibg=blue
autocmd FileType python match ExtraWhitespace /\s\+$/
The first one will show the part of line which is greater than 80 characters in red background color.
Meanwhile the second one will show extra white space at the end of line in blue.
The problem is, they can't working together!
If I enable both of them, only the second ExtraWhitespace
works.
But if I commented out the ExtraWhitespace
, OverLength
starts to work right.
Why did this happened, how to fix it?
match
only works once. It's not the same as asyntax match
.