From 20c5c645902429041b2ad8f351c147b25381cccc Mon Sep 17 00:00:00 2001 From: itchyny Date: Wed, 21 Aug 2013 05:29:08 +0900 Subject: [PATCH] paste mark is now a member of extensions --- autoload/airline.vim | 3 +-- autoload/airline/extensions.vim | 4 ++++ autoload/airline/extensions/paste.vim | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 autoload/airline/extensions/paste.vim diff --git a/autoload/airline.vim b/autoload/airline.vim index f397f0e..0980f21 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -49,8 +49,7 @@ function! airline#get_statusline(winnr, active) let builder = airline#builder#new(a:active, s:highlighter) if airline#util#getwinvar(a:winnr, 'airline_render_left', a:active || (!a:active && !g:airline_inactive_collapse)) - call builder.add_section('airline_a', s:get_section(a:winnr, 'a') - \ .'%{g:airline_detect_paste && &paste ? g:airline_paste_symbol." " : ""}') + call builder.add_section('airline_a', s:get_section(a:winnr, 'a')) call builder.add_section('airline_b', s:get_section(a:winnr, 'b')) call builder.add_section('airline_c', '%<'.s:get_section(a:winnr, 'c')) else diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 9764086..2f1f5f2 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -173,6 +173,10 @@ function! airline#extensions#load() call airline#extensions#readonly#init() endif + if (get(g:, 'airline#extensions#paste#enabled', 1) && get(g:, 'airline_detect_paste', 1)) + call airline#extensions#paste#init() + endif + if g:airline_detect_iminsert call airline#extensions#iminsert#init() endif diff --git a/autoload/airline/extensions/paste.vim b/autoload/airline/extensions/paste.vim new file mode 100644 index 0000000..7ffd7cf --- /dev/null +++ b/autoload/airline/extensions/paste.vim @@ -0,0 +1,14 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:symbol = get(g:, 'airline#extensions#paste#symbol', + \ get(g:, 'airline_paste_symbol', '')) + +function! airline#extensions#paste#get_mark() + return &paste ? ' ' . s:symbol : '' +endfunction + +function! airline#extensions#paste#init() + let g:airline_section_a .= '%{airline#extensions#paste#get_mark()}' +endfunction +