define default statusline items with empty contents.
This commit is contained in:
parent
500ecf7cd0
commit
a13c692529
@ -20,25 +20,6 @@ function! airline#init#bootstrap()
|
|||||||
call s:check_defined('g:airline_exclude_filetypes', [])
|
call s:check_defined('g:airline_exclude_filetypes', [])
|
||||||
call s:check_defined('g:airline_exclude_preview', 0)
|
call s:check_defined('g:airline_exclude_preview', 0)
|
||||||
|
|
||||||
call s:check_defined('g:airline_symbols', {})
|
|
||||||
call extend(g:airline_symbols, {
|
|
||||||
\ 'paste': get(g:, 'airline_paste_symbol', 'PASTE'),
|
|
||||||
\ 'readonly': get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? '' : 'RO'),
|
|
||||||
\ 'whitespace': 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) ? '' : ''),
|
|
||||||
\ }, 'keep')
|
|
||||||
|
|
||||||
call airline#parts#define_function('mode', 'airline#parts#mode')
|
|
||||||
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
|
|
||||||
call airline#parts#define_function('paste', 'airline#parts#paste')
|
|
||||||
call airline#parts#define('readonly', {
|
|
||||||
\ 'function': 'airline#parts#readonly',
|
|
||||||
\ 'highlight': 'airline_file',
|
|
||||||
\ })
|
|
||||||
call airline#parts#define_raw('file', '%f%m')
|
|
||||||
call airline#parts#define_raw('ffenc', '%{printf("%s%s",&fenc,strlen(&ff)>0?"[".&ff."]":"")}')
|
|
||||||
|
|
||||||
call s:check_defined('g:airline_mode_map', {})
|
call s:check_defined('g:airline_mode_map', {})
|
||||||
call extend(g:airline_mode_map, {
|
call extend(g:airline_mode_map, {
|
||||||
\ '__' : '------',
|
\ '__' : '------',
|
||||||
@ -62,6 +43,27 @@ function! airline#init#bootstrap()
|
|||||||
\ '.*solarized.*': 'solarized',
|
\ '.*solarized.*': 'solarized',
|
||||||
\ }, 'keep')
|
\ }, 'keep')
|
||||||
|
|
||||||
|
call s:check_defined('g:airline_symbols', {})
|
||||||
|
call extend(g:airline_symbols, {
|
||||||
|
\ 'paste': get(g:, 'airline_paste_symbol', 'PASTE'),
|
||||||
|
\ 'readonly': get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? '' : 'RO'),
|
||||||
|
\ 'whitespace': 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) ? '' : ''),
|
||||||
|
\ }, 'keep')
|
||||||
|
|
||||||
|
call airline#parts#define_function('mode', 'airline#parts#mode')
|
||||||
|
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
|
||||||
|
call airline#parts#define_function('paste', 'airline#parts#paste')
|
||||||
|
call airline#parts#define('readonly', {
|
||||||
|
\ 'function': 'airline#parts#readonly',
|
||||||
|
\ 'highlight': 'airline_file',
|
||||||
|
\ })
|
||||||
|
call airline#parts#define_raw('file', '%f%m')
|
||||||
|
call airline#parts#define_raw('ffenc', '%{printf("%s%s",&fenc,strlen(&ff)>0?"[".&ff."]":"")}')
|
||||||
|
|
||||||
|
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic'])
|
||||||
|
|
||||||
call airline#extensions#load()
|
call airline#extensions#load()
|
||||||
|
|
||||||
if !exists('g:airline_section_a')
|
if !exists('g:airline_section_a')
|
||||||
|
@ -20,6 +20,12 @@ function! airline#parts#define_raw(key, raw)
|
|||||||
call airline#parts#define(a:key, { 'raw': a:raw })
|
call airline#parts#define(a:key, { 'raw': a:raw })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! airline#parts#define_empty(keys)
|
||||||
|
for key in a:keys
|
||||||
|
call airline#parts#define_raw(key, '')
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! airline#parts#get(key)
|
function! airline#parts#get(key)
|
||||||
return get(s:parts, a:key, {})
|
return get(s:parts, a:key, {})
|
||||||
endfunction
|
endfunction
|
||||||
|
12
t/init.vim
12
t/init.vim
@ -22,9 +22,8 @@ describe 'init'
|
|||||||
Expect g:airline_section_a =~ 'iminsert'
|
Expect g:airline_section_a =~ 'iminsert'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'section b should have hunks and branch'
|
it 'section b should be blank because no extensions are installed'
|
||||||
Expect g:airline_section_b =~ 'hunks'
|
Expect g:airline_section_b == ''
|
||||||
Expect g:airline_section_b =~ 'branch'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'section c should be file'
|
it 'section c should be file'
|
||||||
@ -55,5 +54,12 @@ describe 'init'
|
|||||||
Expect g:airline_section_{s} == s
|
Expect g:airline_section_{s} == s
|
||||||
endfor
|
endfor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'all default statusline extensions should be blank'
|
||||||
|
Expect airline#parts#get('hunks').raw == ''
|
||||||
|
Expect airline#parts#get('branch').raw == ''
|
||||||
|
Expect airline#parts#get('tagbar').raw == ''
|
||||||
|
Expect airline#parts#get('syntastic').raw == ''
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user