mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-17 07:53:41 -05:00
implement component_function_visible_condition in s:subseparator (ref #173)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
" Filename: autoload/lightline.vim
|
" Filename: autoload/lightline.vim
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2016/06/12 22:40:00.
|
" Last Change: 2016/08/21 11:23:58.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -111,6 +111,7 @@ let s:_lightline = {
|
|||||||
\ 'modified': '&modified||!&modifiable', 'readonly': '&readonly', 'paste': '&paste', 'spell': '&spell'
|
\ 'modified': '&modified||!&modifiable', 'readonly': '&readonly', 'paste': '&paste', 'spell': '&spell'
|
||||||
\ },
|
\ },
|
||||||
\ 'component_function': {},
|
\ 'component_function': {},
|
||||||
|
\ 'component_function_visible_condition': {},
|
||||||
\ 'component_expand': {
|
\ 'component_expand': {
|
||||||
\ 'tabs': 'lightline#tabs'
|
\ 'tabs': 'lightline#tabs'
|
||||||
\ },
|
\ },
|
||||||
@@ -293,11 +294,11 @@ function! lightline#highlight(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:subseparator(components, subseparator, expanded) abort
|
function! s:subseparator(components, subseparator, expanded) abort
|
||||||
let [a, c, f, v] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition ]
|
let [a, c, f, v, u ] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition, s:lightline.component_function_visible_condition ]
|
||||||
let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" :
|
let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" :
|
||||||
\ has_key(f, a[v:val]) ? (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"" :
|
\ has_key(f, a[v:val]) ? (has_key(u, a[v:val]) ? "(".u[a[v:val]].")" : (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"") :
|
||||||
\ has_key(v, a[v:val]) ? "(".v[a[v:val]].")" : has_key(c, a[v:val]) ? "1" : "0"')
|
\ has_key(v, a[v:val]) ? "(".v[a[v:val]].")" : has_key(c, a[v:val]) ? "1" : "0"')
|
||||||
return '%{' . (xs[0] ==# '1' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' ? '' : ')') . '?"' . a:subseparator . '":""}'
|
return '%{' . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : ')') . '?"' . a:subseparator . '":""}'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! lightline#concatenate(xs, right) abort
|
function! lightline#concatenate(xs, right) abort
|
||||||
|
|||||||
Reference in New Issue
Block a user