Add spell detection
This commit is contained in:
parent
410429a95c
commit
ae4a978509
@ -175,6 +175,10 @@ function! airline#check_mode(winnr)
|
||||
call add(l:mode, 'crypt')
|
||||
endif
|
||||
|
||||
if g:airline_detect_spell && &spell
|
||||
call add(l:mode, 'spell')
|
||||
endif
|
||||
|
||||
if &readonly || ! &modifiable
|
||||
call add(l:mode, 'readonly')
|
||||
endif
|
||||
|
@ -22,6 +22,7 @@ function! airline#init#bootstrap()
|
||||
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)
|
||||
call s:check_defined('g:airline_detect_spell', 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'])
|
||||
@ -58,6 +59,7 @@ function! airline#init#bootstrap()
|
||||
call s:check_defined('g:airline_symbols', {})
|
||||
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) ? "\u2739" : '!',
|
||||
\ 'linenr': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':',
|
||||
@ -75,6 +77,7 @@ function! airline#init#bootstrap()
|
||||
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
|
||||
call airline#parts#define_function('paste', 'airline#parts#paste')
|
||||
call airline#parts#define_function('crypt', 'airline#parts#crypt')
|
||||
call airline#parts#define_function('spell', 'airline#parts#spell')
|
||||
call airline#parts#define_function('filetype', 'airline#parts#filetype')
|
||||
call airline#parts#define('readonly', {
|
||||
\ 'function': 'airline#parts#readonly',
|
||||
@ -102,7 +105,7 @@ endfunction
|
||||
function! airline#init#sections()
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_a')
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'capslock', 'iminsert'])
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'spell', 'capslock', 'iminsert'])
|
||||
endif
|
||||
if !exists('g:airline_section_b')
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
|
@ -62,6 +62,10 @@ function! airline#parts#paste()
|
||||
return g:airline_detect_paste && &paste ? g:airline_symbols.paste : ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#spell()
|
||||
return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#iminsert()
|
||||
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
|
||||
return toupper(b:keymap_name)
|
||||
|
@ -72,6 +72,9 @@ values):
|
||||
<
|
||||
* enable crypt detection >
|
||||
let g:airline_detect_crypt=1
|
||||
|
||||
* enable spell detection >
|
||||
let g:airline_detect_spell=1
|
||||
<
|
||||
* enable iminsert detection >
|
||||
let g:airline_detect_iminsert=0
|
||||
@ -191,6 +194,7 @@ its contents. >
|
||||
let g:airline_symbols.paste = 'ρ'
|
||||
let g:airline_symbols.paste = 'Þ'
|
||||
let g:airline_symbols.paste = '∥'
|
||||
let g:airline_symbols.spell = 'Ꞩ'
|
||||
let g:airline_symbols.notexists = '∄'
|
||||
let g:airline_symbols.whitespace = 'Ξ'
|
||||
|
||||
@ -223,7 +227,7 @@ section.
|
||||
>
|
||||
variable names default contents
|
||||
----------------------------------------------------------------------------
|
||||
let g:airline_section_a (mode, crypt, paste, iminsert)
|
||||
let g:airline_section_a (mode, crypt, paste, spell, iminsert)
|
||||
let g:airline_section_b (hunks, branch)
|
||||
let g:airline_section_c (bufferline or filename)
|
||||
let g:airline_section_gutter (readonly, csv)
|
||||
@ -771,6 +775,7 @@ Before is a list of parts that are predefined by vim-airline.
|
||||
* `iminsert` displays the current insert method
|
||||
* `paste` displays the paste indicator
|
||||
* `crypt` displays the crypted indicator
|
||||
* `spell` displays the spell indicator
|
||||
* `filetype` displays the file type
|
||||
* `readonly` displays the read only indicator
|
||||
* `file` displays the filename and modified indicator
|
||||
|
@ -18,9 +18,10 @@ describe 'init sections'
|
||||
call s:clear()
|
||||
end
|
||||
|
||||
it 'section a should have mode, paste, iminsert'
|
||||
it 'section a should have mode, paste, spell, iminsert'
|
||||
Expect g:airline_section_a =~ 'mode'
|
||||
Expect g:airline_section_a =~ 'paste'
|
||||
Expect g:airline_section_a =~ 'spell'
|
||||
Expect g:airline_section_a =~ 'iminsert'
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user