refine coding style of arrays

This commit is contained in:
itchyny
2017-12-31 16:30:07 +09:00
parent 583138f1ff
commit 6f84195f10

View File

@@ -2,7 +2,7 @@
" Filename: autoload/lightline.vim " Filename: autoload/lightline.vim
" Author: itchyny " Author: itchyny
" License: MIT License " License: MIT License
" Last Change: 2017/11/11 13:29:26. " Last Change: 2017/12/31 15:55:00.
" ============================================================================= " =============================================================================
let s:save_cpo = &cpo let s:save_cpo = &cpo
@@ -84,20 +84,20 @@ endfunction
let s:_lightline = { let s:_lightline = {
\ 'active': { \ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'filename', 'modified' ] ], \ 'left': [['mode', 'paste'], ['readonly', 'filename', 'modified']],
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat', 'fileencoding', 'filetype' ] ] \ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding', 'filetype']]
\ }, \ },
\ 'inactive': { \ 'inactive': {
\ 'left': [ [ 'filename' ] ], \ 'left': [['filename']],
\ 'right': [ [ 'lineinfo' ], [ 'percent' ] ] \ 'right': [['lineinfo'], ['percent']]
\ }, \ },
\ 'tabline': { \ 'tabline': {
\ 'left': [ [ 'tabs' ] ], \ 'left': [['tabs']],
\ 'right': [ [ 'close' ] ] \ 'right': [['close']]
\ }, \ },
\ 'tab': { \ 'tab': {
\ 'active': [ 'tabnum', 'filename', 'modified' ], \ 'active': ['tabnum', 'filename', 'modified'],
\ 'inactive': [ 'tabnum', 'filename', 'modified' ] \ 'inactive': ['tabnum', 'filename', 'modified']
\ }, \ },
\ 'component': { \ 'component': {
\ 'mode': '%{lightline#mode()}', \ 'mode': '%{lightline#mode()}',
@@ -295,7 +295,7 @@ 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, u ] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition, s:lightline.component_function_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]) ? (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(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"')