public
Last active

Powerline like statusline with colors for both terminal & gui vim

  • Download Gist
.vimrc
VimL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
" Statusline modifications, added Fugitive Status Line & Syntastic Error Message {{{2
let g:last_mode = ''
function! Mode()
let l:mode = mode()
 
if l:mode !=# g:last_mode
let g:last_mode = l:mode
 
hi User2 guifg=#005f00 guibg=#dfff00 gui=BOLD ctermfg=22 ctermbg=190 cterm=BOLD
hi User3 guifg=#FFFFFF guibg=#414243 ctermfg=255 ctermbg=241
hi User4 guifg=#414234 guibg=#2B2B2B ctermfg=241 ctermbg=234
hi User5 guifg=#4e4e4e guibg=#FFFFFF gui=bold ctermfg=239 ctermbg=255 cterm=bold
hi User6 guifg=#FFFFFF guibg=#8a8a8a ctermfg=255 ctermbg=245
hi User7 guifg=#ffff00 guibg=#8a8a8a gui=bold ctermfg=226 ctermbg=245 cterm=bold
hi User8 guifg=#8a8a8a guibg=#414243 ctermfg=245 ctermbg=241
 
if l:mode ==# 'n'
hi User3 guifg=#dfff00 ctermfg=190
elseif l:mode ==# "i"
hi User2 guifg=#005fff guibg=#FFFFFF ctermfg=27 ctermbg=255
hi User3 guifg=#FFFFFF ctermfg=255
elseif l:mode ==# "R"
hi User2 guifg=#FFFFFF guibg=#df0000 ctermfg=255 ctermbg=160
hi User3 guifg=#df0000 ctermfg=160
elseif l:mode ==? "v" || l:mode ==# "^V"
hi User2 guifg=#4e4e4e guibg=#ffaf00 ctermfg=239 ctermbg=214
hi User3 guifg=#ffaf00 ctermfg=214
endif
endif
 
if l:mode ==# "n"
return " NORMAL "
elseif l:mode ==# "i"
return " INSERT "
elseif l:mode ==# "R"
return " REPLACE "
elseif l:mode ==# "v"
return " VISUAL "
elseif l:mode ==# "V"
return " V·LINE "
elseif l:mode ==# "^V"
return " V·BLOCK "
else
return l:mode
endif
endfunction
 
function! GitStatus()
let result = split(system('git status --porcelain '.shellescape(expand('%:t'))." 2>/dev/null|awk '{print $1}'"))
if len(result) > 0 | return join(result).' ' | else | return '' | endif
endfunction
 
set statusline=%2*%{Mode()}%3*⮀
set statusline+=%#StatusLine#
set statusline+=%{strlen(fugitive#statusline())>0?'\ ⭠\ ':''}
set statusline+=%{matchstr(fugitive#statusline(),'(\\zs.*\\ze)')}
set statusline+=%{strlen(fugitive#statusline())>0?'\ \ ⮁\ ':'\ '}
set statusline+=%f%<\ %{&ro?'⭤':''}
set statusline+=%{GitStatus()}
set statusline+=%{&mod?'+':''}
set statusline+=%4*⮀
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%=
set statusline+=%4*⮂
set statusline+=%#StatusLine#
set statusline+=\ %{strlen(&fileformat)>0?&fileformat.'\ ⮃\ ':''}
set statusline+=%{strlen(&fileencoding)>0?&fileencoding.'\ ⮃\ ':''}
set statusline+=%{strlen(&filetype)>0?&filetype.'\ ':''}
set statusline+=%8*⮂%7*\ %p%%\
set statusline+=%6*⮂%5*⭡\ \ %l:%c\
" }}}2

Hi Dhruv, I'm still unable to render some characters properly. This is what it looks on my comp. I have set encoding=utf-8. Does it matter if encoding is set before or after these lines?

kshenoy I think you still need the patched fonts

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.