mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-13 14:03:51 -05:00
s/component_length/component_flag
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
" Version: 0.0
|
" Version: 0.0
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2013/08/22 09:00:36.
|
" Last Change: 2013/08/22 09:06:23.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -31,7 +31,7 @@ function! lightline#init()
|
|||||||
let g:lightline = get(g:, 'lightline', {})
|
let g:lightline = get(g:, 'lightline', {})
|
||||||
let g:lightline.active = get(g:lightline, 'active', {})
|
let g:lightline.active = get(g:lightline, 'active', {})
|
||||||
let g:lightline.inactive = get(g:lightline, 'inactive', {})
|
let g:lightline.inactive = get(g:lightline, 'inactive', {})
|
||||||
let g:lightline.active.left = get(g:lightline.active, 'left', [ [ 'mode' ], [ 'filename', 'modified' ] ])
|
let g:lightline.active.left = get(g:lightline.active, 'left', [ [ 'mode' ], [ 'readonly', 'filename', 'modified' ] ])
|
||||||
let g:lightline.inactive.left = get(g:lightline.inactive, 'left', [ [ 'filename' ] ])
|
let g:lightline.inactive.left = get(g:lightline.inactive, 'left', [ [ 'filename' ] ])
|
||||||
let g:lightline.active.right = get(g:lightline.active, 'right', [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat', 'fileencoding', 'filetype' ] ])
|
let g:lightline.active.right = get(g:lightline.active, 'right', [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat', 'fileencoding', 'filetype' ] ])
|
||||||
let g:lightline.inactive.right = get(g:lightline.inactive, 'right', [ [ 'lineinfo' ], [ 'percent' ] ])
|
let g:lightline.inactive.right = get(g:lightline.inactive, 'right', [ [ 'lineinfo' ], [ 'percent' ] ])
|
||||||
@@ -49,6 +49,7 @@ function! lightline#init()
|
|||||||
\ 'mode': '%{lightline#mode()}',
|
\ 'mode': '%{lightline#mode()}',
|
||||||
\ 'filename': '%t',
|
\ 'filename': '%t',
|
||||||
\ 'modified': '%M',
|
\ 'modified': '%M',
|
||||||
|
\ 'readonly': '%R',
|
||||||
\ 'fileencoding': '%{strlen(&fenc)?&fenc:&enc}',
|
\ 'fileencoding': '%{strlen(&fenc)?&fenc:&enc}',
|
||||||
\ 'fileformat': '%{&fileformat}',
|
\ 'fileformat': '%{&fileformat}',
|
||||||
\ 'filetype': '%{strlen(&filetype)?&filetype:"no ft"}',
|
\ 'filetype': '%{strlen(&filetype)?&filetype:"no ft"}',
|
||||||
@@ -59,12 +60,13 @@ function! lightline#init()
|
|||||||
for [k, v] in items(g:lightline._component)
|
for [k, v] in items(g:lightline._component)
|
||||||
let g:lightline.component[k] = get(g:lightline.component, k, v)
|
let g:lightline.component[k] = get(g:lightline.component, k, v)
|
||||||
endfor
|
endfor
|
||||||
let g:lightline._component_length = {
|
let g:lightline._component_flag = {
|
||||||
\ 'modified': '(&modified||!&modifiable)',
|
\ 'modified': '(&modified||!&modifiable)',
|
||||||
|
\ 'readonly': '(&readonly)',
|
||||||
\ 'fugitive': 'strlen(fugitive#head())' }
|
\ 'fugitive': 'strlen(fugitive#head())' }
|
||||||
let g:lightline.component_length = get(g:lightline, 'component_length', {})
|
let g:lightline.component_flag = get(g:lightline, 'component_flag', {})
|
||||||
for [k, v] in items(g:lightline._component_length)
|
for [k, v] in items(g:lightline._component_flag)
|
||||||
let g:lightline.component_length[k] = get(g:lightline.component_length, k, v)
|
let g:lightline.component_flag[k] = get(g:lightline.component_flag, k, v)
|
||||||
endfor
|
endfor
|
||||||
let g:lightline.separator = get(g:lightline, 'separator', {})
|
let g:lightline.separator = get(g:lightline, 'separator', {})
|
||||||
let g:lightline.separator.left = get(g:lightline.separator, 'left', '')
|
let g:lightline.separator.left = get(g:lightline.separator, 'left', '')
|
||||||
@@ -130,14 +132,14 @@ function! lightline#highlight(mode)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! lightline#subseparator(x, y, s)
|
function! lightline#subseparator(x, y, s)
|
||||||
if has_key(g:lightline.component_length, a:x)
|
if has_key(g:lightline.component_flag, a:x)
|
||||||
if has_key(g:lightline.component_length, a:y)
|
if has_key(g:lightline.component_flag, a:y)
|
||||||
return '%{'.g:lightline.component_length[a:x].'*'.g:lightline.component_length[a:y]."?(g:lightline.subseparator.left):''}"
|
return '%{'.g:lightline.component_flag[a:x].'*'.g:lightline.component_flag[a:y]."?(g:lightline.subseparator.left):''}"
|
||||||
else
|
else
|
||||||
return '%{'.g:lightline.component_length[a:x]."?(g:lightline.subseparator.left):''}"
|
return '%{'.g:lightline.component_flag[a:x]."?(g:lightline.subseparator.left):''}"
|
||||||
endif
|
endif
|
||||||
elseif has_key(g:lightline.component_length, a:y)
|
elseif has_key(g:lightline.component_flag, a:y)
|
||||||
return '%{'.g:lightline.component_length[a:y]."?(g:lightline.subseparator.left):''}"
|
return '%{'.g:lightline.component_flag[a:y]."?(g:lightline.subseparator.left):''}"
|
||||||
else
|
else
|
||||||
return a:s
|
return a:s
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user