Merge pull request #559 from Wraul/feature_capslock

Added extension for tpope/vim-capslock
This commit is contained in:
Bailey Ling 2014-07-30 13:14:27 -04:00
commit 9a1dff320d
4 changed files with 26 additions and 1 deletions

View File

@ -211,6 +211,10 @@ function! airline#extensions#load()
call airline#extensions#nrrwrgn#init(s:ext)
endif
if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline'))
call airline#extensions#capslock#init(s:ext)
endif
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
" load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path).

View File

@ -0,0 +1,14 @@
" MIT License. Copyright (c) 2014 Mathias Andersson.
" vim: et ts=2 sts=2 sw=2
if !exists('*CapsLockStatusline')
finish
endif
function! airline#extensions#capslock#status()
return CapsLockStatusline() == '[caps]' ? 'CAPS' : ''
endfunction
function! airline#extensions#capslock#init(ext)
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status')
endfunction

View File

@ -79,6 +79,7 @@ function! airline#init#bootstrap()
call airline#parts#define_raw('linenr', '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#')
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace'])
call airline#parts#define_text('capslock', '')
unlet g:airline#init#bootstrapping
endfunction
@ -86,7 +87,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', 'paste', 'iminsert'])
let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'capslock', 'iminsert'])
endif
if !exists('g:airline_section_b')
let g:airline_section_b = airline#section#create(['hunks', 'branch'])

View File

@ -502,6 +502,12 @@ NrrwRgn <https://github.com/chrisbra/NrrwRgn>
* enable/disable NrrwRgn integration >
let g:airline#extensions#nrrwrgn#enabled = 1
------------------------------------- *airline-capslock*
vim-capslock <https://github.com/tpope/vim-capslock>
* enable/disable vim-capslock integration >
let g:airline#extensions#capslock#enabled = 1
<
==============================================================================
ADVANCED CUSTOMIZATION *airline-advanced-customization*