diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 9da7b68..52e72a6 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -33,7 +33,7 @@ function! airline#extensions#branch#get_head() return empty(head) || !s:check_in_path() \ ? 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 function! s:check_in_path() diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 07ea2ce..38f9feb 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -56,6 +56,7 @@ function! airline#init#bootstrap() \ 'linenr': get(g:, 'airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ':' ), \ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? '' : ''), \ 'modified': '+', + \ 'space': ' ', \ }, 'keep') call airline#parts#define_function('mode', 'airline#parts#mode') @@ -73,6 +74,7 @@ function! airline#init#bootstrap() endfunction function! airline#init#sections() + let spc = g:airline_symbols.space if !exists('g:airline_section_a') let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'iminsert']) endif @@ -80,7 +82,7 @@ function! airline#init#sections() let g:airline_section_b = airline#section#create(['hunks', 'branch']) endif if !exists('g:airline_section_c') - let g:airline_section_c = airline#section#create(['%<', 'file', ' ', 'readonly']) + let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly']) endif if !exists('g:airline_section_gutter') let g:airline_section_gutter = airline#section#create(['%=']) @@ -92,7 +94,7 @@ function! airline#init#sections() let g:airline_section_y = airline#section#create_right(['ffenc']) endif if !exists('g:airline_section_z') - let g:airline_section_z = airline#section#create(['%3p%% ', 'linenr', ':%3c ']) + let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c ']) endif if !exists('g:airline_section_warning') let g:airline_section_warning = airline#section#create(['syntastic', 'whitespace']) diff --git a/autoload/airline/section.vim b/autoload/airline/section.vim index ef1e043..2ca2b25 100644 --- a/autoload/airline/section.vim +++ b/autoload/airline/section.vim @@ -2,6 +2,7 @@ " vim: et ts=2 sts=2 sw=2 call airline#init#bootstrap() +let s:spc = g:airline_symbols.space function! s:create(parts, append) let _ = '' @@ -19,10 +20,10 @@ function! s:create(parts, append) let func = '"'.(part.text).'"' else 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 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 if exists('part.raw') let _ .= val.(part.raw) diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index fbc06d9..47cddfa 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -2,6 +2,7 @@ " vim: et ts=2 sts=2 sw=2 call airline#init#bootstrap() +let s:spc = g:airline_symbols.space function! airline#util#wrap(text, 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 return '' 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 function! airline#util#prepend(text, minwidth) if a:minwidth > 0 && winwidth(0) < a:minwidth return '' 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 if v:version >= 704 diff --git a/t/section.vim b/t/section.vim index 8d3a4fc..589f4e8 100644 --- a/t/section.vim +++ b/t/section.vim @@ -47,13 +47,13 @@ describe 'section' it 'should force add separators for raw and missing keys' 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']) - Expect s == 'asdf > aaaa > raw' + Expect s == 'asdf > aaaa > raw' 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()}']) - Expect s == '%t < asdf < %{getcwd()}' + Expect s == '%t < asdf < %{getcwd()}' end it 'should empty out parts that do not pass their condition' diff --git a/t/util.vim b/t/util.vim index 913de9d..c438f2f 100644 --- a/t/util.vim +++ b/t/util.vim @@ -17,12 +17,12 @@ describe 'util' it 'has append wrapper function' Expect airline#util#append('', 0) == '' - Expect airline#util#append('1', 0) == ' > 1' + Expect airline#util#append('1', 0) == ' > 1' end it 'has prepend wrapper function' Expect airline#util#prepend('', 0) == '' - Expect airline#util#prepend('1', 0) == '1 < ' + Expect airline#util#prepend('1', 0) == '1 < ' end it 'has getwinvar function' @@ -40,8 +40,8 @@ describe 'util' end it 'should ignore minwidth if less than 0' - Expect airline#util#append('foo', -1) == ' > foo' - Expect airline#util#prepend('foo', -1) == 'foo < ' + Expect airline#util#append('foo', -1) == ' > foo' + Expect airline#util#prepend('foo', -1) == 'foo < ' Expect airline#util#wrap('foo', -1) == 'foo' end