Skip to content

Instantly share code, notes, and snippets.

@ActionScripted
Last active December 24, 2015 00:49
Show Gist options
  • Select an option

  • Save ActionScripted/6719043 to your computer and use it in GitHub Desktop.

Select an option

Save ActionScripted/6719043 to your computer and use it in GitHub Desktop.
Custom, colored status bar example that changes colors depending the file format (in this case, "dos" is bad).
" Colors taken from Solarized color scheme
let s:solr_grays = "ctermfg=240 ctermbg=235 guifg=#586E75 guibg=#073642"
let s:solr_warn = "ctermfg=230 ctermbg=160 guifg=#FDF6E3 guibg=#DC322F"
exe 'hi! User1 ' . s:solr_grays
exe 'hi! User2 ' . s:solr_grays
exe 'hi! User3 ' . s:solr_grays
exe 'hi! User4 ' . s:solr_grays
exe 'hi! User5 ' . s:solr_grays
exe 'hi! User6 ' . s:solr_grays
exe 'hi! User7 ' . s:solr_grays
exe 'hi! User8 ' . s:solr_grays
exe 'hi! User9 ' . s:solr_grays
exe 'hi! User0 ' . s:solr_grays
function! CheckFileFormat()
if &ff == 'dos'
exe 'hi! User4 ' . s:solr_warn
return 'FUCKING [DOS] FILE FORMAT'
else
return &ff
endif
endfunction
set laststatus=2 "required for custom (visible) statusline
set statusline= "GTFO, statusline
set statusline+=%7*\[%n] "buffernr
set statusline+=%1*\ %<%F\ "File+path
set statusline+=%2*\ %y\ "FileType
set statusline+=%3*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding
set statusline+=%3*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
set statusline+=%4*\ %{CheckFileFormat()}\ "FileFormat (dos/unix..)
"set statusline+=%5*\ %{&spelllang}\%{HighlightSearch()}\ "Spellanguage & Highlight on?
set statusline+=%8*\ %=\ row:%l/%L\ (%03p%%)\ "Rownumber/total (%)
set statusline+=%9*\ col:%03c\ "Colnr
set statusline+=%0*\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment