diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 1a74cca..02f1c49 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -17,10 +17,10 @@ function! airline#init#bootstrap() let s:loaded = 1 let g:airline#init#bootstrapping = 1 - call s:check_defined('g:airline_left_sep', get(g:, 'airline_powerline_fonts', 0) ? "\ue0b0" : " ") - call s:check_defined('g:airline_left_alt_sep', get(g:, 'airline_powerline_fonts', 0) ? "\ue0b1" : "|") - call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0) ? "\ue0b2" : " ") - call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0) ? "\ue0b3" : "|") + + let g:airline#util#async = v:version >= 800 && has('job') + let g:airline#util#is_windows = has('win32') || has('win64') + 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_crypt', 1) @@ -32,9 +32,6 @@ function! airline#init#bootstrap() call s:check_defined('g:airline_exclude_preview', 0) call s:check_defined('g:airline_gui_mode', airline#init#gui_mode()) - let g:airline#util#async = v:version >= 800 && has('job') - let g:airline#util#is_windows = has('win32') || has('win64') - call s:check_defined('g:airline_mode_map', {}) call extend(g:airline_mode_map, { \ '__' : '------', @@ -64,19 +61,64 @@ function! airline#init#bootstrap() \ }, 'keep') call s:check_defined('g:airline_symbols', {}) + " First define the symbols, + " that are common in Powerline/Unicode/ASCII mode, + " then add specific symbols for either mode call extend(g:airline_symbols, { - \ 'paste': 'PASTE', - \ 'spell': 'SPELL', - \ 'readonly': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO', - \ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2632" : "\u2632", - \ 'linenr': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : "\u33D1", - \ 'maxlinenr': get(g:, 'airline_powerline_fonts', 0) ? "\u2630" : "\u2630", - \ 'branch': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : "\u16A0", - \ 'notexists': "\u2204", - \ 'modified': '+', - \ 'space': ' ', - \ 'crypt': get(g:, 'airline_crypt_symbol', nr2char(0x1F512)), - \ }, 'keep') + \ 'paste': 'PASTE', + \ 'spell': 'SPELL', + \ 'modified': '+', + \ 'space': ' ' + \ }, 'keep') + + if exists('g:airline_powerline_fonts') + " Symbols for Powerline terminals + call s:check_defined('g:airline_left_sep', "\ue0b0") "  + call s:check_defined('g:airline_left_alt_sep', "\ue0b1") "  + call s:check_defined('g:airline_right_sep', "\ue0b2") "  + call s:check_defined('g:airline_right_alt_sep', "\ue0b3") "  + " ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒 + call extend(g:airline_symbols, { + \ 'readonly': "\ue0a2", + \ 'whitespace': "\u2632", + \ 'linenr': "\u2630", + \ 'maxlinenr': "\ue0a1", + \ 'branch': "\ue0a0", + \ 'notexists': "\u0246", + \ 'crypt': nr2char(0x1F512), + \ }, 'keep') + elseif &encoding==?'utf-8' + " Symbols for Unicode terminals + call s:check_defined('g:airline_left_sep', "") + call s:check_defined('g:airline_left_alt_sep', "") + call s:check_defined('g:airline_right_sep', "") + call s:check_defined('g:airline_right_alt_sep', "") + " ro=⊝, ws=☲, lnr=☰, mlnr=㏑, br=ᚠ, nx=Ɇ, crypt=🔒 + call extend(g:airline_symbols, { + \ 'readonly': "\u229D", + \ 'whitespace': "\u2632", + \ 'linenr': "\u2630", + \ 'maxlinenr': "\u33D1", + \ 'branch': "\u16A0", + \ 'notexists': "\u0246", + \ 'crypt': nr2char(0x1F512), + \ }, 'keep') + else + " Symbols for ASCII terminals + call s:check_defined('g:airline_left_sep', "") + call s:check_defined('g:airline_left_alt_sep', "") + call s:check_defined('g:airline_right_sep', "") + call s:check_defined('g:airline_right_alt_sep', "") + call extend(g:airline_symbols, { + \ 'readonly': 'RO', + \ 'whitespace': '!', + \ 'linenr': 'ln', + \ 'maxlinenr': ':', + \ 'branch': '', + \ 'notexists': '?', + \ 'crypt': 'cr', + \ }, 'keep') + endif call airline#parts#define('mode', { \ 'function': 'airline#parts#mode',