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')
|
call add(l:mode, 'crypt')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if g:airline_detect_spell && &spell
|
||||||
|
call add(l:mode, 'spell')
|
||||||
|
endif
|
||||||
|
|
||||||
if &readonly || ! &modifiable
|
if &readonly || ! &modifiable
|
||||||
call add(l:mode, 'readonly')
|
call add(l:mode, 'readonly')
|
||||||
endif
|
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_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_crypt', 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_detect_iminsert', 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'])
|
||||||
@ -58,6 +59,7 @@ function! airline#init#bootstrap()
|
|||||||
call s:check_defined('g:airline_symbols', {})
|
call s:check_defined('g:airline_symbols', {})
|
||||||
call extend(g:airline_symbols, {
|
call extend(g:airline_symbols, {
|
||||||
\ 'paste': 'PASTE',
|
\ 'paste': 'PASTE',
|
||||||
|
\ 'spell': 'SPELL',
|
||||||
\ 'readonly': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO',
|
\ 'readonly': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO',
|
||||||
\ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!',
|
\ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!',
|
||||||
\ 'linenr': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':',
|
\ '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('iminsert', 'airline#parts#iminsert')
|
||||||
call airline#parts#define_function('paste', 'airline#parts#paste')
|
call airline#parts#define_function('paste', 'airline#parts#paste')
|
||||||
call airline#parts#define_function('crypt', 'airline#parts#crypt')
|
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_function('filetype', 'airline#parts#filetype')
|
||||||
call airline#parts#define('readonly', {
|
call airline#parts#define('readonly', {
|
||||||
\ 'function': 'airline#parts#readonly',
|
\ 'function': 'airline#parts#readonly',
|
||||||
@ -102,7 +105,7 @@ endfunction
|
|||||||
function! airline#init#sections()
|
function! airline#init#sections()
|
||||||
let spc = g:airline_symbols.space
|
let spc = g:airline_symbols.space
|
||||||
if !exists('g:airline_section_a')
|
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
|
endif
|
||||||
if !exists('g:airline_section_b')
|
if !exists('g:airline_section_b')
|
||||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
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 : ''
|
return g:airline_detect_paste && &paste ? g:airline_symbols.paste : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! airline#parts#spell()
|
||||||
|
return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! airline#parts#iminsert()
|
function! airline#parts#iminsert()
|
||||||
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
|
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
|
||||||
return toupper(b:keymap_name)
|
return toupper(b:keymap_name)
|
||||||
|
@ -72,6 +72,9 @@ values):
|
|||||||
<
|
<
|
||||||
* enable crypt detection >
|
* enable crypt detection >
|
||||||
let g:airline_detect_crypt=1
|
let g:airline_detect_crypt=1
|
||||||
|
|
||||||
|
* enable spell detection >
|
||||||
|
let g:airline_detect_spell=1
|
||||||
<
|
<
|
||||||
* enable iminsert detection >
|
* enable iminsert detection >
|
||||||
let g:airline_detect_iminsert=0
|
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.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.notexists = '∄'
|
||||||
let g:airline_symbols.whitespace = 'Ξ'
|
let g:airline_symbols.whitespace = 'Ξ'
|
||||||
|
|
||||||
@ -223,7 +227,7 @@ section.
|
|||||||
>
|
>
|
||||||
variable names default contents
|
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_b (hunks, branch)
|
||||||
let g:airline_section_c (bufferline or filename)
|
let g:airline_section_c (bufferline or filename)
|
||||||
let g:airline_section_gutter (readonly, csv)
|
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
|
* `iminsert` displays the current insert method
|
||||||
* `paste` displays the paste indicator
|
* `paste` displays the paste indicator
|
||||||
* `crypt` displays the crypted indicator
|
* `crypt` displays the crypted indicator
|
||||||
|
* `spell` displays the spell indicator
|
||||||
* `filetype` displays the file type
|
* `filetype` displays the file type
|
||||||
* `readonly` displays the read only indicator
|
* `readonly` displays the read only indicator
|
||||||
* `file` displays the filename and modified indicator
|
* `file` displays the filename and modified indicator
|
||||||
|
@ -18,9 +18,10 @@ describe 'init sections'
|
|||||||
call s:clear()
|
call s:clear()
|
||||||
end
|
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 =~ 'mode'
|
||||||
Expect g:airline_section_a =~ 'paste'
|
Expect g:airline_section_a =~ 'paste'
|
||||||
|
Expect g:airline_section_a =~ 'spell'
|
||||||
Expect g:airline_section_a =~ 'iminsert'
|
Expect g:airline_section_a =~ 'iminsert'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user