I use the following code to have different statusline colors for Normal and Insert modes:
highlight statusLine ctermfg=black ctermbg=red guifg=red guibg=black autocmd InsertLeave * highlight statusline ctermfg=black ctermbg=red guifg=red guibg=black autocmd InsertEnter * highlight statusline ctermfg=black ctermbg=green guifg=green guibg=black
It works fine for me except the color is not changed back to red when I exit from Insert mode by using
Some people suggest to use something like
inoremap <c-c> <c-o>:highlight statusline guifg=red guibg=black<cr><c-c>
for this, but it doesn't work for me. What's wrong with this line?
Also, why not use just
inoremap <c-c> <Esc>? It looks much simpler and it works, but I suspect there are some hidden drawbacks.