From e9196637811884719b051b7249bd61826f0329fe Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Mon, 26 Aug 2013 22:55:11 -0400 Subject: [PATCH] always enable paste detection. --- README.md | 2 +- autoload/airline/extensions.vim | 4 ---- autoload/airline/extensions/paste.vim | 14 -------------- autoload/airline/fragments.vim | 12 ++++++++++++ doc/airline.txt | 9 +++------ plugin/airline.vim | 2 +- 6 files changed, 17 insertions(+), 26 deletions(-) delete mode 100644 autoload/airline/extensions/paste.vim create mode 100644 autoload/airline/fragments.vim diff --git a/README.md b/README.md index d3d5061..1d60c69 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Lean & mean statusline for vim that's light as air. # Straightforward customization -If you don't like the defaults, you can replace all sections with standard `statusline` syntax. +If you don't like the defaults, you can replace all sections with standard `statusline` syntax. Give your statusline that you've built over the years a face lift. ![image](https://f.cloud.github.com/assets/306502/1009429/d69306da-0b38-11e3-94bf-7c6e3eef41e9.png) diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 7dce3d4..7aa6c17 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -199,10 +199,6 @@ 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 get(g:, 'airline#extensions#iminsert#enabled', 0) || get(g:, 'airline_detect_iminsert', 0) call airline#extensions#iminsert#init() endif diff --git a/autoload/airline/extensions/paste.vim b/autoload/airline/extensions/paste.vim deleted file mode 100644 index 9f94835..0000000 --- a/autoload/airline/extensions/paste.vim +++ /dev/null @@ -1,14 +0,0 @@ -" 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', (get(g:, 'airline_powerline_fonts', 0) ? ' ' : '').'PASTE')) - -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 - diff --git a/autoload/airline/fragments.vim b/autoload/airline/fragments.vim new file mode 100644 index 0000000..89f0797 --- /dev/null +++ b/autoload/airline/fragments.vim @@ -0,0 +1,12 @@ +" MIT License. Copyright (c) 2013 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let g:airline#fragments#symbols = get(g:, 'airline#fragments#symbols', {}) +call extend(g:airline#fragments#symbols, { + \ 'paste': get(g:, 'airline_paste_symbol', g:airline_left_alt_sep.' PASTE') + \ }, 'keep') + +function! airline#fragments#get_paste() + return &paste ? ' ' . g:airline#fragments#symbols.paste : '' +endfunction + diff --git a/doc/airline.txt b/doc/airline.txt index ed8d696..900a778 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -46,9 +46,6 @@ values): * enable modified detection > let g:airline_detect_modified=1 -* enable paste detection > - let g:airline_detect_paste=1 -< * enable iminsert detection > let g:airline_detect_iminsert=1 < @@ -132,9 +129,9 @@ separators, as well as the powerline font glyths. let g:airline_linecolumn_prefix = '␤ ' let g:airline_linecolumn_prefix = '¶ ' let g:airline#extensions#branch#symbol = '⎇ ' - let g:airline#extensions#paste#symbol = 'ρ' - let g:airline#extensions#paste#symbol = 'Þ' - let g:airline#extensions#paste#symbol = '∥' + let g:airline#fragments#symbols.paste = 'ρ' + let g:airline#fragments#symbols.paste = 'Þ' + let g:airline#fragments#symbols.paste = '∥' let g:airline#extensions#whitespace#symbol = 'Ξ' " powerline symbols diff --git a/plugin/airline.vim b/plugin/airline.vim index 6c37b21..f75107b 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -49,7 +49,7 @@ call s:check_defined('g:airline_theme_map', { \ '.*solarized.*': 'solarized', \ }) -call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}') +call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}%{airline#fragments#get_paste()}') call s:check_defined('g:airline_section_b', '') call s:check_defined('g:airline_section_c', '%f%m') call s:check_defined('g:airline_section_gutter', '%=')