clean up how symbols are defined.

This commit is contained in:
Bailey Ling 2013-08-26 23:34:02 -04:00
parent fe24924ad3
commit 6dd4cd5423
7 changed files with 34 additions and 52 deletions

View File

@ -195,10 +195,6 @@ function! airline#extensions#load()
endif endif
endif endif
if get(g:, 'airline#extensions#readonly#enabled', 1)
call airline#extensions#readonly#init()
endif
" load all other extensions not part of the default distribution " load all other extensions not part of the default distribution
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
" check to see that both the resolved and unresolved paths do not match " check to see that both the resolved and unresolved paths do not match

View File

@ -3,8 +3,7 @@
let s:empty_message = get(g:, 'airline#extensions#branch#empty_message', let s:empty_message = get(g:, 'airline#extensions#branch#empty_message',
\ get(g:, 'airline_branch_empty_message', '')) \ get(g:, 'airline_branch_empty_message', ''))
let s:symbol = get(g:, 'airline#extensions#branch#symbol', let s:symbol = g:airline_symbols.branch
\ get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? ' ' : ''))
let s:has_fugitive = exists('*fugitive#head') let s:has_fugitive = exists('*fugitive#head')
let s:has_fugitive_detect = exists('*fugitive#detect') let s:has_fugitive_detect = exists('*fugitive#detect')
@ -28,7 +27,7 @@ function! airline#extensions#branch#get_head()
endif endif
endif endif
return empty(head) ? s:empty_message : s:symbol.head return empty(head) ? s:empty_message : s:symbol.' '.head
endfunction endfunction
function! airline#extensions#branch#init(ext) function! airline#extensions#branch#init(ext)

View File

@ -1,15 +0,0 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
let s:symbol = get(g:, 'airline#extensions#readonly#symbol',
\ get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? '' : 'RO'))
function! airline#extensions#readonly#get_mark()
return &ro ? s:symbol : ''
endfunction
function! airline#extensions#readonly#init()
let g:airline_section_gutter = ' %#airline_file#%{airline#extensions#readonly#get_mark()} '
\ .g:airline_section_gutter
endfunction

View File

@ -10,9 +10,7 @@ else
let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1) let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
endif endif
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', let s:symbol = g:airline_symbols.whitespace
\ get(g:, 'airline_whitespace_symbol', get(g:, 'airline_powerline_fonts', 0) ? '✹' : '!'))
let s:checks = get(g:, 'airline#extensions#whitespace#checks', ['indent', 'trailing']) let s:checks = get(g:, 'airline#extensions#whitespace#checks', ['indent', 'trailing'])
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]') let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]')

View File

@ -1,13 +1,8 @@
" MIT License. Copyright (c) 2013 Bailey Ling. " MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
let g:airline#fragments#symbols = get(g:, 'airline#fragments#symbols', {})
call extend(g:airline#fragments#symbols, {
\ 'paste': get(g:, 'airline_paste_symbol', g:airline_left_alt_sep.' PASTE')
\ }, 'keep')
function! airline#fragments#get_paste() function! airline#fragments#get_paste()
return g:airline_detect_paste && &paste ? ' '.g:airline#fragments#symbols.paste : '' return g:airline_detect_paste && &paste ? ' '.g:airline_symbols.paste : ''
endfunction endfunction
function! airline#fragments#get_iminsert() function! airline#fragments#get_iminsert()
@ -17,3 +12,7 @@ function! airline#fragments#get_iminsert()
return '' return ''
endfunction endfunction
function! airline#fragments#get_readonly()
return &readonly ? g:airline_symbols.readonly : ''
endfunction

View File

@ -128,32 +128,32 @@ separators, as well as the powerline font glyths.
let g:airline_left_sep = '▶' let g:airline_left_sep = '▶'
let g:airline_right_sep = '«' let g:airline_right_sep = '«'
let g:airline_right_sep = '◀' let g:airline_right_sep = '◀'
let g:airline_linecolumn_prefix = '␊ ' let g:airline_symbols.linenr = '␊'
let g:airline_linecolumn_prefix = '␤ ' let g:airline_symbols.linenr = '␤'
let g:airline_linecolumn_prefix = '¶ ' let g:airline_symbols.linenr = '¶'
let g:airline#extensions#branch#symbol = '⎇ ' let g:airline_symbols.branch = '⎇'
let g:airline#fragments#symbols.paste = 'ρ' let g:airline_symbols.paste = 'ρ'
let g:airline#fragments#symbols.paste = 'Þ' let g:airline_symbols.paste = 'Þ'
let g:airline#fragments#symbols.paste = '∥' let g:airline_symbols.paste = '∥'
let g:airline#extensions#whitespace#symbol = 'Ξ' let g:airline_symbols.whitespace = 'Ξ'
" powerline symbols " powerline symbols
let g:airline_left_sep = '' let g:airline_left_sep = ''
let g:airline_left_alt_sep = '' let g:airline_left_alt_sep = ''
let g:airline_right_sep = '' let g:airline_right_sep = ''
let g:airline_right_alt_sep = '' let g:airline_right_alt_sep = ''
let g:airline#extensions#branch#symbol = ' ' let g:airline_symbols.branch = ''
let g:airline#extensions#readonly#symbol = '' let g:airline_symbols.readonly = ''
let g:airline_linecolumn_prefix = ' ' let g:airline_symbols.linenr = ''
" old vim-powerline symbols " old vim-powerline symbols
let g:airline_left_sep = '⮀' let g:airline_left_sep = '⮀'
let g:airline_left_alt_sep = '⮁' let g:airline_left_alt_sep = '⮁'
let g:airline_right_sep = '⮂' let g:airline_right_sep = '⮂'
let g:airline_right_alt_sep = '⮃' let g:airline_right_alt_sep = '⮃'
let g:airline#extensions#branch#symbol = '⭠' let g:airline_symbols.branch = '⭠'
let g:airline#extensions#readonly#symbol = '⭤' let g:airline_symbols.readonly = '⭤'
let g:airline_linecolumn_prefix = '⭡' let g:airline_symbols.linenr = '⭡'
< <
For more intricate customizations, you can replace the predefined sections For more intricate customizations, you can replace the predefined sections
@ -245,9 +245,6 @@ vim-signify <https://github.com/mhinz/vim-signify>
* enable/disable detection of whitespace errors. > * enable/disable detection of whitespace errors. >
let g:airline#extensions#whitespace#enabled = 1 let g:airline#extensions#whitespace#enabled = 1
< <
* customize the whitespace symbol. >
let g:airline#extensions#whitespace#symbol = '!'
<
* configure which whitespace checks to enable. > * configure which whitespace checks to enable. >
let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing' ] let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing' ]
< <

View File

@ -23,12 +23,20 @@ call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts
call s:check_defined('g:airline_detect_modified', 1) call s:check_defined('g:airline_detect_modified', 1)
call s:check_defined('g:airline_detect_paste', 1) call s:check_defined('g:airline_detect_paste', 1)
call s:check_defined('g:airline_detect_iminsert', 0) call s:check_defined('g:airline_detect_iminsert', 0)
call s:check_defined('g:airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0)?' ':':')
call s:check_defined('g:airline_inactive_collapse', 1) call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
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', g:airline_left_alt_sep.' 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 s:check_defined('g:airline_mode_map', { call s:check_defined('g:airline_mode_map', {
\ '__' : '------', \ '__' : '------',
\ 'n' : 'NORMAL', \ 'n' : 'NORMAL',
@ -50,13 +58,13 @@ call s:check_defined('g:airline_theme_map', {
\ '.*solarized.*': 'solarized', \ '.*solarized.*': 'solarized',
\ }) \ })
call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}%{airline#fragments#get_paste()}%{airline#fragments#get_iminsert()}') call s:check_defined('g:airline_section_a', '%{get(w:,"airline_current_mode","")}%{airline#fragments#get_paste()}%{airline#fragments#get_iminsert()}')
call s:check_defined('g:airline_section_b', '') call s:check_defined('g:airline_section_b', '')
call s:check_defined('g:airline_section_c', '%f%m') call s:check_defined('g:airline_section_c', '%f%m')
call s:check_defined('g:airline_section_gutter', '%=') call s:check_defined('g:airline_section_gutter', '%#airline_file#%{airline#fragments#get_readonly()}%=')
call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}") call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}")
call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}") call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}")
call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c') call s:check_defined('g:airline_section_z', '%3p%% %{g:airline_symbols.linenr} %3l:%3c')
call s:check_defined('g:airline_section_warning', '__') call s:check_defined('g:airline_section_warning', '__')
let s:airline_initialized = 0 let s:airline_initialized = 0