2015-10-11 02:45:58 +02:00
|
|
|
""
|
|
|
|
"" Settings
|
|
|
|
""
|
|
|
|
|
2015-10-10 17:23:21 +02:00
|
|
|
let g:lightline = {
|
|
|
|
\"active": {
|
|
|
|
\ "left": [[ "mode", "paste" ],
|
|
|
|
\ ["fugitive", "filename", "readonly", "ctrlpmark"]],
|
2015-10-11 02:45:58 +02:00
|
|
|
\ "right": [ ["syntastic", "percent"],
|
|
|
|
\ ["fileencoding", "filetype"]]
|
2015-10-10 17:23:21 +02:00
|
|
|
\ },
|
2015-10-11 02:45:58 +02:00
|
|
|
\'separator': { 'left': '', 'right': '' },
|
|
|
|
\'subseparator': { 'left': '→', 'right': '∘' },
|
|
|
|
\"component": {
|
2015-10-10 17:23:21 +02:00
|
|
|
\"readonly": '%{&filetype=="help"?"":&readonly?"∅":""}',
|
|
|
|
\"modified": '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
|
|
|
|
\ },
|
|
|
|
\'component_visible_condition': {
|
|
|
|
\"readonly": '(&filetype!="help"&& &readonly)',
|
|
|
|
\"modified": '(&filetype!="help"&&(&modified||!&modifiable))'
|
|
|
|
\ },
|
|
|
|
\"component_expand": {
|
|
|
|
\ "syntastic": "SyntasticStatuslineFlag",
|
|
|
|
\ },
|
|
|
|
\"component_type": {
|
|
|
|
\ "syntastic": "error",
|
|
|
|
\ },
|
|
|
|
\"component_function": {
|
|
|
|
\ "filename": "Filename",
|
|
|
|
\ "fugitive": "Fugitive",
|
|
|
|
\ "filetype": "Filetype",
|
|
|
|
\ "fileencoding": "Fileencoding",
|
|
|
|
\ "mode": "Mode",
|
|
|
|
\ "ctrlpmark": "CtrlPMark",
|
|
|
|
\ }
|
|
|
|
\ }
|
|
|
|
|
2015-10-11 02:45:58 +02:00
|
|
|
|
|
|
|
""
|
|
|
|
"" 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
|
|
|
|
""
|
|
|
|
|
2015-10-10 17:23:21 +02:00
|
|
|
function! Fugitive()
|
2015-10-10 17:38:24 +02:00
|
|
|
if &ft !~? 'tagbar' && exists("*fugitive#head")
|
2015-10-10 17:23:21 +02:00
|
|
|
let _ = fugitive#head()
|
2015-10-11 02:45:58 +02:00
|
|
|
return strlen(_) ? "Σ "._ : ""
|
2015-10-10 17:23:21 +02:00
|
|
|
endif
|
|
|
|
return ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Modified()
|
2015-10-11 02:45:58 +02:00
|
|
|
return &ft =~ "help" ? "" : &modified ? "Δ" : &modifiable ? "" : "δ"
|
2015-10-10 17:23:21 +02:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Readonly()
|
|
|
|
return &ft !~? "help" && &readonly ? "RO" : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Filename()
|
|
|
|
let fname = expand('%:t')
|
|
|
|
return fname == 'ControlP' ? g:lightline.ctrlp_item :
|
|
|
|
\ fname == '__Tagbar__' ? g:lightline.fname :
|
|
|
|
\ ('' != fname ? fname : '[No Name]') .
|
|
|
|
\ ('' != Modified() ? ' ' . Modified() : '')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Filetype()
|
|
|
|
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : "no ft") : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Fileencoding()
|
|
|
|
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Mode()
|
|
|
|
let fname = expand("%:t")
|
|
|
|
return fname == "__Tagbar__" ? "Tagbar" :
|
|
|
|
\ fname == "ControlP" ? "CtrlP" :
|
|
|
|
\ winwidth(0) > 60 ? lightline#mode() : ""
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! CtrlPMark()
|
|
|
|
if expand("%:t") =~ "ControlP"
|
|
|
|
call lightline#link("iR"[g:lightline.ctrlp_regex])
|
2015-10-11 02:45:58 +02:00
|
|
|
return lightline#concatenate([g:lightline.ctrlp_prev,
|
|
|
|
\ g:lightline.ctrlp_item,
|
|
|
|
\ g:lightline.ctrlp_next], 0)
|
2015-10-10 17:23:21 +02:00
|
|
|
else
|
|
|
|
return ""
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! CtrlPStatusMain(focus, byfname, regex, prev, item, next, marked)
|
|
|
|
let g:lightline.ctrlp_regex = a:regex
|
|
|
|
let g:lightline.ctrlp_prev = a:prev
|
|
|
|
let g:lightline.ctrlp_item = a:item
|
|
|
|
let g:lightline.ctrlp_next = a:next
|
|
|
|
return lightline#statusline(0)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! CtrlPStatusProg(str)
|
|
|
|
return lightline#statusline(0)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! TagbarStatusFunc(current, sort, fname, ...) abort
|
|
|
|
let g:lightline.fname = a:fname
|
|
|
|
return lightline#statusline(0)
|
|
|
|
endfunction
|