use code 160 for space to fix rendering problems.
This commit is contained in:
parent
0860d2f525
commit
12ea154de8
|
@ -33,7 +33,7 @@ function! airline#extensions#branch#get_head()
|
||||||
|
|
||||||
return empty(head) || !s:check_in_path()
|
return empty(head) || !s:check_in_path()
|
||||||
\ ? s:empty_message
|
\ ? s:empty_message
|
||||||
\ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.' ', head)
|
\ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.(g:airline_symbols.space), head)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:check_in_path()
|
function! s:check_in_path()
|
||||||
|
|
|
@ -56,6 +56,7 @@ function! airline#init#bootstrap()
|
||||||
\ 'linenr': get(g:, 'airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ':' ),
|
\ 'linenr': get(g:, 'airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ':' ),
|
||||||
\ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ''),
|
\ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ''),
|
||||||
\ 'modified': '+',
|
\ 'modified': '+',
|
||||||
|
\ 'space': ' ',
|
||||||
\ }, 'keep')
|
\ }, 'keep')
|
||||||
|
|
||||||
call airline#parts#define_function('mode', 'airline#parts#mode')
|
call airline#parts#define_function('mode', 'airline#parts#mode')
|
||||||
|
@ -72,6 +73,7 @@ function! airline#init#bootstrap()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#init#sections()
|
function! airline#init#sections()
|
||||||
|
let spc = g:airline_symbols.space
|
||||||
if !exists('g:airline_section_a')
|
if !exists('g:airline_section_a')
|
||||||
let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'iminsert'])
|
let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'iminsert'])
|
||||||
endif
|
endif
|
||||||
|
@ -82,7 +84,7 @@ function! airline#init#sections()
|
||||||
let g:airline_section_c = airline#section#create(['%<', 'file'])
|
let g:airline_section_c = airline#section#create(['%<', 'file'])
|
||||||
endif
|
endif
|
||||||
if !exists('g:airline_section_gutter')
|
if !exists('g:airline_section_gutter')
|
||||||
let g:airline_section_gutter = airline#section#create([' ', 'readonly', '%='])
|
let g:airline_section_gutter = airline#section#create([spc, 'readonly', '%='])
|
||||||
endif
|
endif
|
||||||
if !exists('g:airline_section_x')
|
if !exists('g:airline_section_x')
|
||||||
let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype'])
|
let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype'])
|
||||||
|
@ -91,7 +93,7 @@ function! airline#init#sections()
|
||||||
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
||||||
endif
|
endif
|
||||||
if !exists('g:airline_section_z')
|
if !exists('g:airline_section_z')
|
||||||
let g:airline_section_z = airline#section#create_right(['%3p%% %{g:airline_symbols.linenr} %3l:%3c '])
|
let g:airline_section_z = airline#section#create_right(['%3p%%'.spc.(g:airline_symbols.linenr).spc.'%3l:%3c'.spc])
|
||||||
endif
|
endif
|
||||||
if !exists('g:airline_section_warning')
|
if !exists('g:airline_section_warning')
|
||||||
let g:airline_section_warning = airline#section#create(['syntastic', 'whitespace'])
|
let g:airline_section_warning = airline#section#create(['syntastic', 'whitespace'])
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
" vim: et ts=2 sts=2 sw=2
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
call airline#init#bootstrap()
|
call airline#init#bootstrap()
|
||||||
|
let s:spc = g:airline_symbols.space
|
||||||
|
|
||||||
function! s:create(parts, append)
|
function! s:create(parts, append)
|
||||||
let _ = ''
|
let _ = ''
|
||||||
|
@ -19,10 +20,10 @@ function! s:create(parts, append)
|
||||||
let func = '"'.(part.text).'"'
|
let func = '"'.(part.text).'"'
|
||||||
else
|
else
|
||||||
if a:append > 0 && idx != 0
|
if a:append > 0 && idx != 0
|
||||||
let val .= ' '.g:airline_left_alt_sep.' '
|
let val .= s:spc.g:airline_left_alt_sep.s:spc
|
||||||
endif
|
endif
|
||||||
if a:append < 0 && idx != 0
|
if a:append < 0 && idx != 0
|
||||||
let val = ' '.g:airline_right_alt_sep.' '.val
|
let val = s:spc.g:airline_right_alt_sep.s:spc.val
|
||||||
endif
|
endif
|
||||||
if exists('part.raw')
|
if exists('part.raw')
|
||||||
let _ .= val.(part.raw)
|
let _ .= val.(part.raw)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
" vim: et ts=2 sts=2 sw=2
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
call airline#init#bootstrap()
|
call airline#init#bootstrap()
|
||||||
|
let s:spc = g:airline_symbols.space
|
||||||
|
|
||||||
function! airline#util#wrap(text, minwidth)
|
function! airline#util#wrap(text, minwidth)
|
||||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||||
|
@ -14,14 +15,14 @@ function! airline#util#append(text, minwidth)
|
||||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
return empty(a:text) ? '' : ' '.g:airline_left_alt_sep.' '.a:text
|
return empty(a:text) ? '' : s:spc.g:airline_left_alt_sep.s:spc.a:text
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#util#prepend(text, minwidth)
|
function! airline#util#prepend(text, minwidth)
|
||||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
return empty(a:text) ? '' : a:text.' '.g:airline_right_alt_sep.' '
|
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if v:version >= 704
|
if v:version >= 704
|
||||||
|
|
|
@ -47,13 +47,13 @@ describe 'section'
|
||||||
|
|
||||||
it 'should force add separators for raw and missing keys'
|
it 'should force add separators for raw and missing keys'
|
||||||
let s = airline#section#create_left(['asdf', 'raw'])
|
let s = airline#section#create_left(['asdf', 'raw'])
|
||||||
Expect s == 'asdf > raw'
|
Expect s == 'asdf > raw'
|
||||||
let s = airline#section#create_left(['asdf', 'aaaa', 'raw'])
|
let s = airline#section#create_left(['asdf', 'aaaa', 'raw'])
|
||||||
Expect s == 'asdf > aaaa > raw'
|
Expect s == 'asdf > aaaa > raw'
|
||||||
let s = airline#section#create_right(['raw', '%f'])
|
let s = airline#section#create_right(['raw', '%f'])
|
||||||
Expect s == 'raw < %f'
|
Expect s == 'raw < %f'
|
||||||
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}'])
|
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}'])
|
||||||
Expect s == '%t < asdf < %{getcwd()}'
|
Expect s == '%t < asdf < %{getcwd()}'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should empty out parts that do not pass their condition'
|
it 'should empty out parts that do not pass their condition'
|
||||||
|
|
|
@ -17,12 +17,12 @@ describe 'util'
|
||||||
|
|
||||||
it 'has append wrapper function'
|
it 'has append wrapper function'
|
||||||
Expect airline#util#append('', 0) == ''
|
Expect airline#util#append('', 0) == ''
|
||||||
Expect airline#util#append('1', 0) == ' > 1'
|
Expect airline#util#append('1', 0) == ' > 1'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has prepend wrapper function'
|
it 'has prepend wrapper function'
|
||||||
Expect airline#util#prepend('', 0) == ''
|
Expect airline#util#prepend('', 0) == ''
|
||||||
Expect airline#util#prepend('1', 0) == '1 < '
|
Expect airline#util#prepend('1', 0) == '1 < '
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has getwinvar function'
|
it 'has getwinvar function'
|
||||||
|
@ -40,8 +40,8 @@ describe 'util'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should ignore minwidth if less than 0'
|
it 'should ignore minwidth if less than 0'
|
||||||
Expect airline#util#append('foo', -1) == ' > foo'
|
Expect airline#util#append('foo', -1) == ' > foo'
|
||||||
Expect airline#util#prepend('foo', -1) == 'foo < '
|
Expect airline#util#prepend('foo', -1) == 'foo < '
|
||||||
Expect airline#util#wrap('foo', -1) == 'foo'
|
Expect airline#util#wrap('foo', -1) == 'foo'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue