How can I change vim status line color?

后端 未结 3 655
粉色の甜心
粉色の甜心 2020-12-23 20:02

I\'m tring to change vim\'s status line color by editing my .vimrc .

By using the command au, I tried to change the color of the status lin

3条回答
  •  礼貌的吻别
    2020-12-23 20:18

    I use this for my status line, which changes the colour of the line depending on what mode I'm in, amongst other tidbits:

    function! InsertStatuslineColor(mode)
      if a:mode == 'i'
        hi statusline guibg=Cyan ctermfg=6 guifg=Black ctermbg=0
      elseif a:mode == 'r'
        hi statusline guibg=Purple ctermfg=5 guifg=Black ctermbg=0
      else
        hi statusline guibg=DarkRed ctermfg=1 guifg=Black ctermbg=0
      endif
    endfunction
    
    au InsertEnter * call InsertStatuslineColor(v:insertmode)
    au InsertLeave * hi statusline guibg=DarkGrey ctermfg=8 guifg=White ctermbg=15
    
    " default the statusline to green when entering Vim
    hi statusline guibg=DarkGrey ctermfg=8 guifg=White ctermbg=15
    
    " Formats the statusline
    set statusline=%f                           " file name
    set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
    set statusline+=%{&ff}] "file format
    set statusline+=%y      "filetype
    set statusline+=%h      "help file flag
    set statusline+=%m      "modified flag
    set statusline+=%r      "read only flag
    
    " Puts in the current git status
        if count(g:pathogen_disabled, 'Fugitive') < 1   
            set statusline+=%{fugitive#statusline()}
        endif
    
    " Puts in syntastic warnings
        if count(g:pathogen_disabled, 'Syntastic') < 1  
            set statusline+=%#warningmsg#
            set statusline+=%{SyntasticStatuslineFlag()}
            set statusline+=%*
        endif
    
    set statusline+=\ %=                        " align left
    set statusline+=Line:%l/%L[%p%%]            " line X of Y [percent of file]
    set statusline+=\ Col:%c                    " current column
    set statusline+=\ Buf:%n                    " Buffer number
    set statusline+=\ [%b][0x%B]\               " ASCII and byte code under cursor
    

提交回复
热议问题