From bb2010a8696458d1c28057e14b79e346f2864820 Mon Sep 17 00:00:00 2001 From: itchyny Date: Thu, 14 Apr 2016 00:19:30 +0900 Subject: [PATCH] fix s:subseparator - wrap the visible conditions with parenthesis - fix for older versions of Vim (do not use v:key of map(); s:map does not capture the environment) --- autoload/lightline.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/lightline.vim b/autoload/lightline.vim index d54e571..e1c791d 100644 --- a/autoload/lightline.vim +++ b/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2016/04/13 20:36:13. +" Last Change: 2016/04/14 00:16:41. " ============================================================================= let s:save_cpo = &cpo @@ -343,11 +343,11 @@ function! lightline#highlight(...) abort endfunction function! s:subseparator(components, subseparator, expanded) abort - let [c, f, v] = [ s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition ] - let xs = s:map(a:components, 'a:expanded[v:key] ? "1" : has_key(f, v:val) ? - \ (exists("*".f[v:val]) ? "(".f[v:val]."()!=#\"\")" : "(exists(\"*".f[v:val]."\")?".f[v:val]."()!=#\"\":0)") : - \ get(v, v:val, has_key(c, v:val) ? "1" : "0")') - return '%{' . xs[0] . '&&(' . join(xs[1:], '||') . ')?"' . a:subseparator . '":""}' + let [a, c, f, v] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition ] + let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" : + \ has_key(f, a[v:val]) ? (exists("*".f[a[v:val]]) ? "(".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"') + return '%{' . (xs[0] !=# '1' ? xs[0] . '&&' : '') . '(' . join(xs[1:], '||') . ')?"' . a:subseparator . '":""}' endfunction function! lightline#concatenate(xs, right) abort