mirror of
https://github.com/prurigro/darkcloud-nvimconfig.git
synced 2024-11-24 20:31:25 -05:00
Style the tabline
This commit is contained in:
parent
cc3ccf294a
commit
eaaa31bffe
1 changed files with 59 additions and 56 deletions
|
@ -1,89 +1,94 @@
|
||||||
function! LLModified()
|
function! LLModified()
|
||||||
return &ft =~ 'help' ? '' : &modified ? '*' : &modifiable ? '' : '-'
|
return &ft =~ "help" ? "" : &modified ? "*" : &modifiable ? "" : "-"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LLReadonly()
|
function! LLReadonly()
|
||||||
return &ft !~? 'help' && &readonly ? '[RO]' : ''
|
return &ft !~? "help" && &readonly ? "[RO]" : ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LLFilename()
|
function! LLFilename()
|
||||||
let fname = expand('%:t')
|
let fname = expand("%:t")
|
||||||
|
|
||||||
return
|
return
|
||||||
\ fname == '__Tagbar__.1' ? g:lightline.fname :
|
\ fname == "__Tagbar__.1" ? g:lightline.fname :
|
||||||
\ &ft == 'qf' ? '[Error/Location List]' :
|
\ &ft == "qf" ? "[Error/Location List]" :
|
||||||
\ ('' != LLReadonly() ? LLReadonly() . ' ' : '') .
|
\ ("" != LLReadonly() ? LLReadonly() . " " : "") .
|
||||||
\ ('' != fname ? fname : '[NEW]') .
|
\ ("" != fname ? fname : "[NEW]") .
|
||||||
\ ('' != LLModified() ? ' ' . LLModified() : '')
|
\ ("" != LLModified() ? " " . LLModified() : "")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LLFugitive()
|
function! LLFugitive()
|
||||||
if expand('%:t') !~? 'Tagbar' && exists('*FugitiveHead')
|
if expand("%:t") !~? "Tagbar" && exists("*FugitiveHead")
|
||||||
let mark = '' "edit here for cool mark
|
let mark = ""
|
||||||
let _ = FugitiveHead()
|
let _ = FugitiveHead()
|
||||||
return strlen(_) ? mark._ : ''
|
return strlen(_) ? mark._ : ""
|
||||||
else
|
else
|
||||||
return ''
|
return ""
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LLFileformat()
|
function! LLFileformat()
|
||||||
return winwidth(0) > 70 ? &fileformat : ''
|
return winwidth(0) > 70 ? &fileformat : ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LLFiletype()
|
function! LLFiletype()
|
||||||
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'none') : ''
|
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : "none") : ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LLFileencoding()
|
function! LLFileencoding()
|
||||||
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
|
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LLMode()
|
function! LLMode()
|
||||||
let fname = expand('%:t')
|
let fname = expand("%:t")
|
||||||
|
|
||||||
return fname == '__Tagbar__' ? 'Tagbar' :
|
return fname == "__Tagbar__" ? "Tagbar" :
|
||||||
\ winwidth(0) > 60 ? lightline#mode() : ''
|
\ winwidth(0) > 60 ? lightline#mode() : ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let g:tagbar_status_func = 'TagbarStatusFunc'
|
let g:tagbar_status_func = "TagbarStatusFunc"
|
||||||
|
|
||||||
function! TagbarStatusFunc(current, sort, fname, ...) abort
|
function! TagbarStatusFunc(current, sort, fname, ...) abort
|
||||||
let g:lightline.fname = 'tags'
|
let g:lightline.fname = "tags"
|
||||||
return lightline#statusline(0)
|
return lightline#statusline(0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let g:lightline = {
|
let g:lightline = {
|
||||||
\ 'component_function': {
|
\ "enable": {
|
||||||
\ 'fugitive': 'LLFugitive',
|
\ "statusline": 1,
|
||||||
\ 'filename': 'LLFilename',
|
\ "tabline": 1
|
||||||
\ 'fileformat': 'LLFileformat',
|
|
||||||
\ 'filetype': 'LLFiletype',
|
|
||||||
\ 'fileencoding': 'LLFileencoding',
|
|
||||||
\ 'mode': 'LLMode'
|
|
||||||
\ },
|
\ },
|
||||||
\
|
\
|
||||||
\ 'component_expand': {
|
\ "component_function": {
|
||||||
\ 'linter_checking': 'lightline#ale#checking',
|
\ "fugitive": "LLFugitive",
|
||||||
\ 'linter_warnings': 'lightline#ale#warnings',
|
\ "filename": "LLFilename",
|
||||||
\ 'linter_errors': 'lightline#ale#errors',
|
\ "fileformat": "LLFileformat",
|
||||||
\ 'linter_ok': 'lightline#ale#ok'
|
\ "filetype": "LLFiletype",
|
||||||
|
\ "fileencoding": "LLFileencoding",
|
||||||
|
\ "mode": "LLMode"
|
||||||
\ },
|
\ },
|
||||||
\
|
\
|
||||||
\ 'component_type': {
|
\ "component_expand": {
|
||||||
\ 'linter_checking': 'left',
|
\ "linter_checking": "lightline#ale#checking",
|
||||||
\ 'linter_warnings': 'warning',
|
\ "linter_warnings": "lightline#ale#warnings",
|
||||||
\ 'linter_errors': 'error',
|
\ "linter_errors": "lightline#ale#errors",
|
||||||
\ 'linter_ok': 'left'
|
\ "linter_ok": "lightline#ale#ok"
|
||||||
\ },
|
\ },
|
||||||
\
|
\
|
||||||
\ 'component': {
|
\ "component_type": {
|
||||||
\ 'tagbar': '%{tagbar#currenttag("[%s]", "", "f")}'
|
\ "linter_checking": "left",
|
||||||
|
\ "linter_warnings": "warning",
|
||||||
|
\ "linter_errors": "error",
|
||||||
|
\ "linter_ok": "left"
|
||||||
\ },
|
\ },
|
||||||
\
|
\
|
||||||
\ 'active': {
|
\ "component": {
|
||||||
\ 'left': [[ 'mode', 'paste' ], [ 'fugitive', 'filename' ], [ 'tagbar' ]],
|
\ "tagbar": "%{tagbar#currenttag('[%s]', '', 'f')}"
|
||||||
\ 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ], [ 'fileformat', 'fileencoding', 'filetype' ], [ 'percent', 'lineinfo' ]]
|
\ },
|
||||||
|
\
|
||||||
|
\ "active": {
|
||||||
|
\ "left": [[ "mode", "paste" ], [ "fugitive", "filename" ], [ "tagbar" ]],
|
||||||
|
\ "right": [[ "linter_checking", "linter_errors", "linter_warnings", "linter_ok" ], [ "fileformat", "fileencoding", "filetype" ], [ "percent", "lineinfo" ]]
|
||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
@ -93,23 +98,20 @@ let g:lightline#ale#indicator_errors = "E:"
|
||||||
let g:lightline#ale#indicator_ok = "OK"
|
let g:lightline#ale#indicator_ok = "OK"
|
||||||
|
|
||||||
"status bar config with and without powerline fonts (default: 0)
|
"status bar config with and without powerline fonts (default: 0)
|
||||||
if !exists("g:enablepowerline")
|
|
||||||
let g:enablepowerline = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (g:enablepowerline == 1)
|
if (g:enablepowerline == 1)
|
||||||
let g:lightline.separator = { 'left': '', 'right': '' }
|
let g:lightline.separator = { "left": "", "right": "" }
|
||||||
let g:lightline.subseparator = { 'left': '', 'right': '' }
|
let g:lightline.subseparator = { "left": "", "right": "" }
|
||||||
else
|
else
|
||||||
let g:lightline.separator = { 'left': '', 'right': '' }
|
let g:lightline.separator = { "left": "", "right": "" }
|
||||||
let g:lightline.subseparator = { 'left': '|', 'right': '|' }
|
let g:lightline.subseparator = { "left": "|", "right": "|" }
|
||||||
|
let g:lightline.tabline_subseparator = { "left": "", "right": "" }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"ligtline theme {{{
|
"ligtline theme {{{
|
||||||
let s:p = { 'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {} }
|
let s:p = { "normal": {}, "inactive": {}, "insert": {}, "replace": {}, "visual": {}, "tabline": {} }
|
||||||
|
|
||||||
if &term != "linux"
|
if &term != "linux"
|
||||||
let g:lightline.colorscheme = 'darkcloud'
|
let g:lightline.colorscheme = "darkcloud"
|
||||||
|
|
||||||
let s:p.normal.left = [[ g:cBlue, g:cDarkBg ], [ g:cWhite, g:cLightBg ]]
|
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.inactive.left = [[ g:cGray3, g:cDarkBg ], [ g:cGray3, g:cLightBg ]]
|
||||||
|
@ -121,13 +123,14 @@ endif
|
||||||
let s:p.visual.left = [[ g:cYellow, g:cLightBg ], [ 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.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 ]]
|
|
||||||
let s:p.tabline.right = copy(s:p.normal.right)
|
|
||||||
let s:p.normal.error = [[ g:cRed, g:cLightBg ]]
|
let s:p.normal.error = [[ g:cRed, g:cLightBg ]]
|
||||||
let s:p.normal.warning = [[ g:cYellow, g:cLightBg ]]
|
let s:p.normal.warning = [[ g:cYellow, g:cLightBg ]]
|
||||||
|
|
||||||
|
let s:p.tabline.left = [[ g:cGray2, g:cLightBg ]]
|
||||||
|
let s:p.tabline.tabsel = [[ g:cWhite, g:cDarkBg ]]
|
||||||
|
let s:p.tabline.middle = [[ g:cGray2, g:cLightBg ]]
|
||||||
|
let s:p.tabline.right = [[ g:cWhite, g:cDarkBg ]]
|
||||||
|
|
||||||
let g:lightline#colorscheme#darkcloud#palette = lightline#colorscheme#fill(s:p)
|
let g:lightline#colorscheme#darkcloud#palette = lightline#colorscheme#fill(s:p)
|
||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
|
|
Loading…
Reference in a new issue