2018-03-11 19:21:58 -04:00
|
|
|
function! LLModified()
|
|
|
|
return &ft =~ 'help' ? '' : &modified ? '*' : &modifiable ? '' : '-'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LLReadonly()
|
|
|
|
return &ft !~? 'help' && &readonly ? '[RO]' : ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LLFilename()
|
|
|
|
let fname = expand('%:t')
|
|
|
|
|
|
|
|
return
|
2020-11-30 17:12:46 -05:00
|
|
|
\ fname == '__Tagbar__.1' ? g:lightline.fname :
|
2018-03-11 19:21:58 -04:00
|
|
|
\ &ft == 'qf' ? '[Error/Location List]' :
|
|
|
|
\ ('' != LLReadonly() ? LLReadonly() . ' ' : '') .
|
|
|
|
\ ('' != fname ? fname : '[NEW]') .
|
|
|
|
\ ('' != LLModified() ? ' ' . LLModified() : '')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LLFugitive()
|
2024-03-01 16:28:35 -05:00
|
|
|
if expand('%:t') !~? 'Tagbar' && exists('*FugitiveHead')
|
2020-11-30 17:12:46 -05:00
|
|
|
let mark = '' "edit here for cool mark
|
|
|
|
let _ = FugitiveHead()
|
|
|
|
return strlen(_) ? mark._ : ''
|
|
|
|
else
|
2018-03-13 11:32:04 -04:00
|
|
|
return ''
|
2020-11-30 17:12:46 -05:00
|
|
|
endif
|
2018-03-11 19:21:58 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LLFileformat()
|
|
|
|
return winwidth(0) > 70 ? &fileformat : ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LLFiletype()
|
|
|
|
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'none') : ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LLFileencoding()
|
|
|
|
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LLMode()
|
|
|
|
let fname = expand('%:t')
|
|
|
|
|
|
|
|
return fname == '__Tagbar__' ? 'Tagbar' :
|
|
|
|
\ winwidth(0) > 60 ? lightline#mode() : ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
let g:tagbar_status_func = 'TagbarStatusFunc'
|
|
|
|
|
|
|
|
function! TagbarStatusFunc(current, sort, fname, ...) abort
|
2018-03-14 11:38:51 -04:00
|
|
|
let g:lightline.fname = 'tags'
|
2018-03-11 19:21:58 -04:00
|
|
|
return lightline#statusline(0)
|
|
|
|
endfunction
|
|
|
|
|
2020-11-30 17:12:46 -05:00
|
|
|
let g:lightline = {
|
|
|
|
\ 'component_function': {
|
2018-03-13 11:32:04 -04:00
|
|
|
\ 'fugitive': 'LLFugitive',
|
|
|
|
\ 'filename': 'LLFilename',
|
|
|
|
\ 'fileformat': 'LLFileformat',
|
|
|
|
\ 'filetype': 'LLFiletype',
|
|
|
|
\ 'fileencoding': 'LLFileencoding',
|
2020-11-30 15:56:33 -05:00
|
|
|
\ 'mode': 'LLMode'
|
2020-11-30 17:12:46 -05:00
|
|
|
\ },
|
|
|
|
\
|
|
|
|
\ 'component_expand': {
|
2018-03-13 11:32:04 -04:00
|
|
|
\ 'linter_checking': 'lightline#ale#checking',
|
|
|
|
\ 'linter_warnings': 'lightline#ale#warnings',
|
|
|
|
\ 'linter_errors': 'lightline#ale#errors',
|
|
|
|
\ 'linter_ok': 'lightline#ale#ok'
|
2020-11-30 17:12:46 -05:00
|
|
|
\ },
|
|
|
|
\
|
|
|
|
\ 'component_type': {
|
2018-03-13 11:32:04 -04:00
|
|
|
\ 'linter_checking': 'left',
|
|
|
|
\ 'linter_warnings': 'warning',
|
|
|
|
\ 'linter_errors': 'error',
|
|
|
|
\ 'linter_ok': 'left'
|
2020-11-30 17:12:46 -05:00
|
|
|
\ },
|
|
|
|
\
|
|
|
|
\ 'component': {
|
2018-03-13 11:32:04 -04:00
|
|
|
\ 'tagbar': '%{tagbar#currenttag("[%s]", "", "f")}'
|
2020-11-30 17:12:46 -05:00
|
|
|
\ },
|
|
|
|
\
|
|
|
|
\ 'active': {
|
2018-03-13 11:32:04 -04:00
|
|
|
\ 'left': [[ 'mode', 'paste' ], [ 'fugitive', 'filename' ], [ 'tagbar' ]],
|
2020-12-02 13:50:08 -05:00
|
|
|
\ 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ], [ 'fileformat', 'fileencoding', 'filetype' ], [ 'percent', 'lineinfo' ]]
|
2018-03-13 11:32:04 -04:00
|
|
|
\ }
|
2020-11-30 17:12:46 -05:00
|
|
|
\ }
|
|
|
|
|
|
|
|
let g:lightline#ale#indicator_checking = ""
|
|
|
|
let g:lightline#ale#indicator_warnings = "W:"
|
|
|
|
let g:lightline#ale#indicator_errors = "E:"
|
|
|
|
let g:lightline#ale#indicator_ok = "OK"
|
2018-03-11 19:21:58 -04:00
|
|
|
|
|
|
|
"status bar config with and without powerline fonts (default: 0)
|
2024-03-01 21:59:23 -05:00
|
|
|
if !exists("g:enablepowerline")
|
|
|
|
let g:enablepowerline = 0
|
2018-03-11 19:21:58 -04:00
|
|
|
endif
|
|
|
|
|
2024-03-01 21:59:23 -05:00
|
|
|
if (g:enablepowerline == 1)
|
2018-03-13 11:32:04 -04:00
|
|
|
let g:lightline.separator = { 'left': '', 'right': '' }
|
|
|
|
let g:lightline.subseparator = { 'left': '', 'right': '' }
|
2018-03-11 19:21:58 -04:00
|
|
|
else
|
2018-03-13 11:32:04 -04:00
|
|
|
let g:lightline.separator = { 'left': '', 'right': '' }
|
|
|
|
let g:lightline.subseparator = { 'left': '|', 'right': '|' }
|
2018-03-11 19:21:58 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
"ligtline theme {{{
|
2018-03-13 11:32:04 -04:00
|
|
|
let s:p = { 'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {} }
|
|
|
|
|
2023-08-17 16:17:46 -04:00
|
|
|
if &term != "linux"
|
2023-08-17 16:23:56 -04:00
|
|
|
let g:lightline.colorscheme = 'darkcloud'
|
|
|
|
|
2024-02-01 13:20:34 -05:00
|
|
|
let s:p.normal.left = [[ g:cBlue, g:cDarkBg ], [ g:cWhite, g:cLightBg ]]
|
|
|
|
let s:p.inactive.left = [[ g:cGray3, g:cDarkBg ], [ g:cGray3, g:cLightBg ]]
|
|
|
|
let s:p.normal.right = [[ g:cWhite, g:cDarkBg ], [ g:cWhite, g:cLightBg ], [ g:cWhite, g:cDarkBg ]]
|
|
|
|
let s:p.inactive.right = [[ g:cGray3, g:cDarkBg ], [ g:cGray3, g:cLightBg ], [ g:cGray3, g:cDarkBg ]]
|
|
|
|
|
|
|
|
let s:p.insert.left = [[ g:cRed, g:cLightBg ], [ g:cWhite, g:cDarkBg ]]
|
|
|
|
let s:p.replace.left = [[ g:cLightBg, g:cRed ], [ g:cWhite, g:cDarkBg ]]
|
|
|
|
let s:p.visual.left = [[ g:cYellow, g:cLightBg ], [ g:cWhite, g:cDarkBg ]]
|
|
|
|
|
|
|
|
let s:p.normal.middle = [[ g:cWhite, g:cLightBg ]]
|
|
|
|
let s:p.tabline.left = [[ g:cWhite, g:cDarkBg ]]
|
|
|
|
let s:p.tabline.tabsel = [[ g:cWhite, g:cLightBg ]]
|
|
|
|
let s:p.tabline.middle = [[ g:cDarkBg, g:cGray1 ]]
|
2023-08-17 16:17:46 -04:00
|
|
|
let s:p.tabline.right = copy(s:p.normal.right)
|
2024-02-01 13:20:34 -05:00
|
|
|
let s:p.normal.error = [[ g:cRed, g:cLightBg ]]
|
|
|
|
let s:p.normal.warning = [[ g:cYellow, g:cLightBg ]]
|
2023-08-17 16:17:46 -04:00
|
|
|
|
|
|
|
let g:lightline#colorscheme#darkcloud#palette = lightline#colorscheme#fill(s:p)
|
|
|
|
endif
|
2018-03-11 19:21:58 -04:00
|
|
|
"}}}
|