spell: Display spelling language

fixes: #1521
This commit is contained in:
Christian Brabandt 2017-08-01 19:25:20 +02:00
parent 0c307d5f73
commit a2e20bc3ca
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 16 additions and 1 deletions

View File

@ -25,6 +25,7 @@ function! airline#init#bootstrap()
call s:check_defined('g:airline_detect_paste', 1)
call s:check_defined('g:airline_detect_crypt', 1)
call s:check_defined('g:airline_detect_spell', 1)
call s:check_defined('g:airline_detect_spelllang', 1)
call s:check_defined('g:airline_detect_iminsert', 0)
call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])

View File

@ -65,7 +65,17 @@ function! airline#parts#paste()
endfunction
function! airline#parts#spell()
return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : ''
if g:airline_detect_spell && &spell
if winwidth(0) >= 90
return g:airline_symbols.spell . spelllang
elseif winwidth(0) >= 70
return g:airline_symbols.spell
else
return split(g:airline_symbols.spell, '\zs')[0]
endif
endif
return ''
endfunction
function! airline#parts#iminsert()

View File

@ -131,6 +131,10 @@ values):
* enable spell detection >
let g:airline_detect_spell=1
* display spelling language when spell detection is enabled
(if enough space is available) >
let g:airline_detect_spelllang=1
<
* enable iminsert detection >
let g:airline_detect_iminsert=0