mirror of
https://github.com/vim-airline/vim-airline-themes.git
synced 2025-01-19 12:02:44 +08:00
fix parts being undefined when referenced by sections in vimrc (#207).
This commit is contained in:
parent
c8ef456a25
commit
d123e3583a
|
@ -14,6 +14,8 @@ function! airline#init#bootstrap()
|
|||
endif
|
||||
let s:loaded = 1
|
||||
|
||||
let g:airline#init#bootstrapping = 1
|
||||
|
||||
call s:check_defined('g:airline_left_sep', get(g:, 'airline_powerline_fonts', 0)?"":">")
|
||||
call s:check_defined('g:airline_left_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"":">")
|
||||
call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0)?"":"<")
|
||||
|
@ -61,10 +63,6 @@ function! airline#init#bootstrap()
|
|||
\ 'modified': '+',
|
||||
\ 'space': ' ',
|
||||
\ }, 'keep')
|
||||
endfunction
|
||||
|
||||
function! airline#init#sections()
|
||||
let g:airline#init#initializing_sections = 1
|
||||
|
||||
call airline#parts#define('mode', {
|
||||
\ 'function': 'airline#parts#mode',
|
||||
|
@ -82,6 +80,10 @@ function! airline#init#sections()
|
|||
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
||||
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'whitespace'])
|
||||
|
||||
unlet g:airline#init#bootstrapping
|
||||
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'])
|
||||
|
@ -107,7 +109,5 @@ function! airline#init#sections()
|
|||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['syntastic', 'whitespace'])
|
||||
endif
|
||||
|
||||
unlet g:airline#init#initializing_sections
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ let s:parts = {}
|
|||
|
||||
function! airline#parts#define(key, config)
|
||||
let s:parts[a:key] = get(s:parts, a:key, {})
|
||||
if exists('g:airline#init#initializing_sections')
|
||||
if exists('g:airline#init#bootstrapping')
|
||||
call extend(s:parts[a:key], a:config, 'keep')
|
||||
else
|
||||
call extend(s:parts[a:key], a:config, 'force')
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
call airline#init#bootstrap()
|
||||
call airline#extensions#load()
|
||||
|
||||
function! SectionSpec()
|
||||
endfunction
|
||||
|
||||
|
@ -11,6 +8,11 @@ describe 'section'
|
|||
call airline#parts#define_function('func', 'SectionSpec')
|
||||
end
|
||||
|
||||
it 'should be able to reference default parts'
|
||||
let s = airline#section#create(['paste'])
|
||||
Expect s == '%{airline#util#wrap(airline#parts#paste(),0)}'
|
||||
end
|
||||
|
||||
it 'should create sections with no separators'
|
||||
let s = airline#section#create(['text', 'raw', 'func'])
|
||||
Expect s == '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}'
|
||||
|
@ -43,6 +45,7 @@ describe 'section'
|
|||
end
|
||||
|
||||
it 'should parse out a section from the distro'
|
||||
call airline#extensions#load()
|
||||
let s = airline#section#create(['whitespace'])
|
||||
Expect s =~ 'airline#extensions#whitespace#check'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user