Add vim-grepper extension

- Displays a segment when a grepper search is running
This commit is contained in:
Mo Hyun 2018-07-23 13:05:34 -07:00
parent 964f53a418
commit 723987eca9
4 changed files with 32 additions and 1 deletions

View File

@ -309,6 +309,11 @@ function! airline#extensions#load()
call add(loaded_ext, 'gutentags') call add(loaded_ext, 'gutentags')
endif endif
if (get(g:, 'airline#extensions#grepper#enabled', 1) && get(g:, 'loaded_grepper', 0))
call airline#extensions#grepper#init(s:ext)
call add(loaded_ext, 'grepper')
endif
if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib')) if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib'))
call airline#extensions#xkblayout#init(s:ext) call airline#extensions#xkblayout#init(s:ext)
call add(loaded_ext, 'xkblayout') call add(loaded_ext, 'xkblayout')

View File

@ -0,0 +1,19 @@
" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al.
" vim: et ts=2 sts=2 sw=2
" Heavily derived from the Gutentags extension
scriptencoding utf-8
if !get(g:, 'loaded_grepper', 0)
finish
endif
function! airline#extensions#grepper#status()
let msg = grepper#statusline()
return empty(msg) ? '' : 'grepper'
endfunction
function! airline#extensions#grepper#init(ext)
call airline#parts#define_function('grepper', 'airline#extensions#grepper#status')
endfunction

View File

@ -151,6 +151,7 @@ function! airline#init#bootstrap()
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count']) \ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count'])
call airline#parts#define_text('capslock', '') call airline#parts#define_text('capslock', '')
call airline#parts#define_text('gutentags', '') call airline#parts#define_text('gutentags', '')
call airline#parts#define_text('grepper', '')
call airline#parts#define_text('xkblayout', '') call airline#parts#define_text('xkblayout', '')
call airline#parts#define_text('keymap', '') call airline#parts#define_text('keymap', '')
@ -180,7 +181,7 @@ function! airline#init#sections()
let g:airline_section_gutter = airline#section#create(['%=']) let g:airline_section_gutter = airline#section#create(['%='])
endif endif
if !exists('g:airline_section_x') if !exists('g:airline_section_x')
let g:airline_section_x = airline#section#create_right(['tagbar', 'gutentags', 'filetype']) let g:airline_section_x = airline#section#create_right(['tagbar', 'gutentags', 'grepper', 'filetype'])
endif endif
if !exists('g:airline_section_y') if !exists('g:airline_section_y')
let g:airline_section_y = airline#section#create_right(['ffenc']) let g:airline_section_y = airline#section#create_right(['ffenc'])

View File

@ -1002,6 +1002,12 @@ vim-gutentags <https://github.com/ludovicchabant/vim-gutentags>
* enable/disable vim-gutentags integration > * enable/disable vim-gutentags integration >
let g:airline#extensions#gutentags#enabled = 1 let g:airline#extensions#gutentags#enabled = 1
------------------------------------- *airline-grepper*
vim-grepper <https://github.com/mhinz/vim-grepper>
* enable/disable vim-grepper integration >
let g:airline#extensions#grepper#enabled = 1
------------------------------------- *airline-capslock* ------------------------------------- *airline-capslock*
vim-capslock <https://github.com/tpope/vim-capslock> vim-capslock <https://github.com/tpope/vim-capslock>