Simplify crypt indicator generation

nr2char() is a much simpler way to obtain UTF-8 codepoints beyond 0xFFFF.
This commit is contained in:
D.E. Akers 2015-06-09 10:04:10 -04:00
parent 540c148d31
commit 9837c1e7c8

View File

@ -55,9 +55,6 @@ function! airline#init#bootstrap()
\ }, 'keep') \ }, 'keep')
call s:check_defined('g:airline_symbols', {}) call s:check_defined('g:airline_symbols', {})
let s:airline_crypt=''
" generate crypt symbol, "\u" only accepts up to 4 chars
exe 'sil norm!' ":\<C-V>U1F512\<c-\>eextend(s:, {'airline_crypt': getcmdline()}).airline_crypt\n"
call extend(g:airline_symbols, { call extend(g:airline_symbols, {
\ 'paste': get(g:, 'airline_paste_symbol', 'PASTE'), \ 'paste': get(g:, 'airline_paste_symbol', 'PASTE'),
\ 'readonly': get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO'), \ 'readonly': get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO'),
@ -66,9 +63,8 @@ function! airline#init#bootstrap()
\ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : ''), \ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : ''),
\ 'modified': '+', \ 'modified': '+',
\ 'space': ' ', \ 'space': ' ',
\ 'crypt': get(g:, 'airline_crypt_symbol', s:airline_crypt), \ 'crypt': get(g:, 'airline_crypt_symbol', nr2char(0x1F512, 1)),
\ }, 'keep') \ }, 'keep')
unlet! s:airline_crypt
call airline#parts#define('mode', { call airline#parts#define('mode', {
\ 'function': 'airline#parts#mode', \ 'function': 'airline#parts#mode',