2015-10-10 17:23:21 +02:00
|
|
|
let g:lightline = {
|
|
|
|
\"active": {
|
|
|
|
\ "left": [[ "mode", "paste" ],
|
|
|
|
\ ["fugitive", "filename", "readonly", "ctrlpmark"]],
|
|
|
|
\ "right": [ ["syntastic", "lineinfo"], ["percent"],
|
|
|
|
\ ["fileformat", "fileencoding", "filetype"]]
|
|
|
|
\ },
|
|
|
|
\"component": {
|
|
|
|
\"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",
|
|
|
|
\ "fileformat": "Fileformat",
|
|
|
|
\ "filetype": "Filetype",
|
|
|
|
\ "fileencoding": "Fileencoding",
|
|
|
|
\ "mode": "Mode",
|
|
|
|
\ "ctrlpmark": "CtrlPMark",
|
|
|
|
\ }
|
|
|
|
\ }
|
|
|
|
|
|
|
|
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()
|
|
|
|
return strlen(_) ? "μ "._ : ""
|
|
|
|
endif
|
|
|
|
return ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! Modified()
|
|
|
|
return &ft =~ "help" ? "" : &modified ? "+" : &modifiable ? "" : "-"
|
|
|
|
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! Fileformat()
|
|
|
|
return winwidth(0) > 70 ? &fileformat : ""
|
|
|
|
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])
|
|
|
|
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
|
|
|
|
\ , g:lightline.ctrlp_next], 0)
|
|
|
|
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
|