Search code examples
vimconfiguration-filesmodecolor-schemetyping

Vim: Changing colorscheme in normal mode


I would like to have a different colorscheme when i'm in normal mode/visual mode and switch to my default colorscheme when i'm in my insertion mode. Is it possible ?


Solution

  • Thanks but it's for the status line. I found a solution like this in my vimrc :

    noremap i :highlight Normal guibg=grey8<cr>i
    noremap o :highlight Normal guibg=grey8<cr>o
    noremap s :highlight Normal guibg=grey8<cr>s
    noremap a :highlight Normal guibg=grey8<cr>a
    noremap I :highlight Normal guibg=grey8<cr>I
    noremap O :highlight Normal guibg=grey8<cr>O
    noremap S :highlight Normal guibg=grey8<cr>S
    noremap A :highlight Normal guibg=grey8<cr>A
    
    "You need the next line to change the color back when you hit escape.
    inoremap <Esc> <Esc>:highlight Normal guibg=black<cr>