Customize status bar

This commit is contained in:
rnhmjoj 2015-10-11 02:45:58 +02:00
parent 737558e5a8
commit 3a2e85cb9f

View File

@ -1,11 +1,17 @@
""
"" Settings
""
let g:lightline = { let g:lightline = {
\"active": { \"active": {
\ "left": [[ "mode", "paste" ], \ "left": [[ "mode", "paste" ],
\ ["fugitive", "filename", "readonly", "ctrlpmark"]], \ ["fugitive", "filename", "readonly", "ctrlpmark"]],
\ "right": [ ["syntastic", "lineinfo"], ["percent"], \ "right": [ ["syntastic", "percent"],
\ ["fileformat", "fileencoding", "filetype"]] \ ["fileencoding", "filetype"]]
\ }, \ },
\"component": { \'separator': { 'left': '', 'right': '' },
\'subseparator': { 'left': '→', 'right': '∘' },
\"component": {
\"readonly": '%{&filetype=="help"?"":&readonly?"∅":""}', \"readonly": '%{&filetype=="help"?"":&readonly?"∅":""}',
\"modified": '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}' \"modified": '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
\ }, \ },
@ -22,7 +28,6 @@ let g:lightline = {
\"component_function": { \"component_function": {
\ "filename": "Filename", \ "filename": "Filename",
\ "fugitive": "Fugitive", \ "fugitive": "Fugitive",
\ "fileformat": "Fileformat",
\ "filetype": "Filetype", \ "filetype": "Filetype",
\ "fileencoding": "Fileencoding", \ "fileencoding": "Fileencoding",
\ "mode": "Mode", \ "mode": "Mode",
@ -30,16 +35,48 @@ let g:lightline = {
\ } \ }
\ } \ }
""
"" Color scheme
""
let s:p = {'normal': {}, 'inactive': {},
\'insert': {}, 'replace' : {},
\'visual': {}, 'tabline' : {}}
let s:p.normal.left = [ [ 07, 14 ], [ 08, 00 ] ]
let s:p.insert.left = [ [ 07, 05 ], [ 14, 00 ] ]
let s:p.visual.left = [ [ 00, 03 ], [ 14, 00 ] ]
let s:p.replace.left = [ [ 00, 02 ], [ 14, 00 ] ]
let s:p.inactive.left = [ [ 12, 00 ], [ 15, 00 ] ]
let s:p.tabline.left = [ [ 14, 00 ] ]
let s:p.normal.right = [ [ 12, 00 ], [ 03, 00 ] ]
let s:p.tabline.right = [ [ 12, 00 ], [ 03, 00 ] ]
let s:p.inactive.right = [ [ 12, 00 ], [ 13, 00 ] ]
let s:p.normal.middle = [ [ 12, 00 ] ]
let s:p.inactive.middle = [ [ 12, 00 ] ]
let s:p.tabline.middle = [ [ 14, 00 ] ]
let s:p.tabline.tabsel = [ [ 14, 00 ] ]
let s:p.normal.error = [ [ 00, 05 ] ]
let s:p.normal.warning = [ [ 00, 02 ] ]
let g:lightline#colorscheme#default#palette = lightline#colorscheme#fill(s:p)
""
"" Function helpers
""
function! Fugitive() function! Fugitive()
if &ft !~? 'tagbar' && exists("*fugitive#head") if &ft !~? 'tagbar' && exists("*fugitive#head")
let _ = fugitive#head() let _ = fugitive#head()
return strlen(_) ? "μ "._ : "" return strlen(_) ? "Σ "._ : ""
endif endif
return '' return ''
endfunction endfunction
function! Modified() function! Modified()
return &ft =~ "help" ? "" : &modified ? "+" : &modifiable ? "" : "-" return &ft =~ "help" ? "" : &modified ? "Δ" : &modifiable ? "" : "
endfunction endfunction
function! Readonly() function! Readonly()
@ -54,10 +91,6 @@ function! Filename()
\ ('' != Modified() ? ' ' . Modified() : '') \ ('' != Modified() ? ' ' . Modified() : '')
endfunction endfunction
function! Fileformat()
return winwidth(0) > 70 ? &fileformat : ""
endfunction
function! Filetype() function! Filetype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : "no ft") : "" return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : "no ft") : ""
endfunction endfunction
@ -76,8 +109,9 @@ endfunction
function! CtrlPMark() function! CtrlPMark()
if expand("%:t") =~ "ControlP" if expand("%:t") =~ "ControlP"
call lightline#link("iR"[g:lightline.ctrlp_regex]) call lightline#link("iR"[g:lightline.ctrlp_regex])
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item return lightline#concatenate([g:lightline.ctrlp_prev,
\ , g:lightline.ctrlp_next], 0) \ g:lightline.ctrlp_item,
\ g:lightline.ctrlp_next], 0)
else else
return "" return ""
endif endif