Dynamically resize section Z

Resolves: #2168
This commit is contained in:
Rick Jones 2020-07-08 22:23:38 +01:00
parent 2fec415a5d
commit ee4afdeedb
2 changed files with 6 additions and 6 deletions

View File

@ -149,7 +149,7 @@ function! airline#init#bootstrap()
call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('path', '%F%m')
call airline#parts#define('linenr', {
\ 'raw': '%{g:airline_symbols.linenr}%4l',
\ 'raw': '%{g:airline_symbols.linenr}%l',
\ 'accent': 'bold'})
call airline#parts#define('maxlinenr', {
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
@ -213,9 +213,9 @@ function! airline#init#sections()
endif
if !exists('g:airline_section_z')
if airline#util#winwidth() > 79
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%p%%'.spc, 'linenr', 'maxlinenr', ':%v'])
else
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v'])
let g:airline_section_z = airline#section#create(['%p%%'.spc, 'linenr', ':%v'])
endif
endif
if !exists('g:airline_section_error')

View File

@ -43,9 +43,9 @@ describe 'init sections'
end
it 'section z should be line numbers'
Expect g:airline_section_z =~ '%3p%%'
Expect g:airline_section_z =~ '%4l'
Expect g:airline_section_z =~ '%3v'
Expect g:airline_section_z =~ '%p%%'
Expect g:airline_section_z =~ '%l'
Expect g:airline_section_z =~ '%v'
end
it 'should not redefine sections already defined'