mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-13 22:13:50 -05:00
improve truncate detection
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
" Version: 0.0
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/08/22 09:07:55.
|
||||
" Last Change: 2013/08/22 09:40:39.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
@@ -31,7 +31,7 @@ function! lightline#init()
|
||||
let g:lightline = get(g:, 'lightline', {})
|
||||
let g:lightline.active = get(g:lightline, 'active', {})
|
||||
let g:lightline.inactive = get(g:lightline, 'inactive', {})
|
||||
let g:lightline.active.left = get(g:lightline.active, 'left', [ [ 'mode' ], [ 'readonly', 'filename', 'modified' ] ])
|
||||
let g:lightline.active.left = get(g:lightline.active, 'left', [ [ 'mode' ], [ 'fugitive', 'readonly', 'filename', 'modified' ] ])
|
||||
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.inactive.right = get(g:lightline.inactive, 'right', [ [ 'lineinfo' ], [ 'percent' ] ])
|
||||
@@ -132,17 +132,7 @@ function! lightline#highlight(mode)
|
||||
endfunction
|
||||
|
||||
function! lightline#subseparator(x, y, s)
|
||||
if has_key(g:lightline.component_flag, a:x)
|
||||
if has_key(g:lightline.component_flag, a:y)
|
||||
return '%{'.g:lightline.component_flag[a:x].'*'.g:lightline.component_flag[a:y]."?(g:lightline.subseparator.left):''}"
|
||||
else
|
||||
return '%{'.g:lightline.component_flag[a:x]."?(g:lightline.subseparator.left):''}"
|
||||
endif
|
||||
elseif has_key(g:lightline.component_flag, a:y)
|
||||
return '%{'.g:lightline.component_flag[a:y]."?(g:lightline.subseparator.left):''}"
|
||||
else
|
||||
return a:s
|
||||
endif
|
||||
return '%{('.get(g:lightline.component_flag,a:x,'1').')*('.join(map(copy(a:y),'get(g:lightline.component_flag,v:val,"1")'),'+').")?('".a:s."'):''}"
|
||||
endfunction
|
||||
|
||||
function! lightline#statusline(inactive)
|
||||
@@ -155,7 +145,7 @@ function! lightline#statusline(inactive)
|
||||
for j in range(len(left[i]))
|
||||
let _ .= '%( '.g:lightline.component[left[i][j]].' %)'
|
||||
if j < len(left[i]) - 1
|
||||
let _ .= lightline#subseparator(left[i][j], left[i][j+1], g:lightline.subseparator.left)
|
||||
let _ .= lightline#subseparator(left[i][j], left[i][j+1:], g:lightline.subseparator.left)
|
||||
endif
|
||||
endfor
|
||||
let _ .= printf('%%#LightLineLeft_%s_%d_%d#', mode, i, i + 1) . g:lightline.separator.left
|
||||
@@ -166,7 +156,7 @@ function! lightline#statusline(inactive)
|
||||
let _ .= printf('%%#LightLineRight_%s_%d#', mode, i)
|
||||
for j in range(len(right[i]))
|
||||
if j
|
||||
let _ .= lightline#subseparator(right[i][j], right[i][j-1], g:lightline.subseparator.right)
|
||||
let _ .= lightline#subseparator(right[i][j], right[i][:j-1], g:lightline.subseparator.right)
|
||||
endif
|
||||
let _ .= '%( '.g:lightline.component[right[i][j]].' %)'
|
||||
endfor
|
||||
|
||||
Reference in New Issue
Block a user