From e13a4c8b1a0f46e6c51c192f462af141246f781e Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Thu, 29 Aug 2013 00:36:07 +0000 Subject: [PATCH] convert the rest to use define section. --- autoload/airline/extensions/tagbar.vim | 10 ++++++++-- plugin/airline.vim | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/autoload/airline/extensions/tagbar.vim b/autoload/airline/extensions/tagbar.vim index bf7efee..4b51787 100644 --- a/autoload/airline/extensions/tagbar.vim +++ b/autoload/airline/extensions/tagbar.vim @@ -16,11 +16,17 @@ function! airline#extensions#tagbar#inactive_apply(...) endif endfunction +function! airline#extensions#tagbar#currenttag() + if get(w:, 'airline_active', 0) + return tagbar#currenttag('%s', '') + endif + return '' +endfunction + function! airline#extensions#tagbar#init(ext) call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply') let g:tagbar_status_func = 'airline#extensions#tagbar#get_status' - let g:airline_parts.tagbar = '%(%{get(w:,"airline_active",0) ? tagbar#currenttag("%s","") : ""} ' - \ .g:airline_right_alt_sep.' %)' + let g:airline_parts.tagbar = 'airline#extensions#tagbar#currenttag' endfunction diff --git a/plugin/airline.vim b/plugin/airline.vim index e5b812b..179446f 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -83,11 +83,11 @@ function! s:init() call airline#util#define_section('a', ['mode', 'paste', 'iminsert']) call airline#util#define_section('b', ['hunks', 'branch']) call airline#util#define_section('c', ['%<', 'file']) - call s:check_defined('g:airline_section_gutter', ' '.(g:airline_parts.readonly).'%=') - call s:check_defined('g:airline_section_x', (g:airline_parts.tagbar).'%{&filetype}') - call s:check_defined('g:airline_section_y', g:airline_parts.ffenc) - call s:check_defined('g:airline_section_z', '%3p%% %{g:airline_symbols.linenr} %3l:%3c ') - call s:check_defined('g:airline_section_warning', (g:airline_parts.syntastic).(g:airline_parts.whitespace)) + call airline#util#define_section('gutter', ['readonly', '%=']) + call airline#util#define_section('x', ['tagbar', '%{&filetype}']) + call airline#util#define_section('y', ['ffenc']) + call airline#util#define_section('z', ['%3p%% %{g:airline_symbols.linenr} %3l:%3c ']) + call airline#util#define_section('warning', ['syntastic', 'whitespace']) let s:airline_theme_defined = exists('g:airline_theme') if s:airline_theme_defined || !airline#switch_matching_theme()