diff --git a/autoload/airline.vim b/autoload/airline.vim index 19258374..1f063a26 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -26,7 +26,6 @@ function! airline#add_inactive_statusline_func(name) endfunction function! airline#load_theme() - highlight! default link airline_warning WarningMsg call airline#highlighter#load_theme() call airline#extensions#load_theme() endfunction diff --git a/autoload/airline/extensions/default.vim b/autoload/airline/extensions/default.vim index c24a1f5f..4ae686ce 100644 --- a/autoload/airline/extensions/default.vim +++ b/autoload/airline/extensions/default.vim @@ -23,14 +23,18 @@ function! s:get_section(winnr, key, ...) return empty(text) ? '' : prefix.text.suffix endfunction -function! s:build_sections(builder, keys, winnr) +function! s:build_sections(builder, context, keys) for key in a:keys + if key == 'warning' && !a:context.active + continue + endif + " i have no idea why the warning section needs special treatment, but it's " needed to prevent separators from showing up if key == 'warning' call a:builder.add_raw('%(') endif - call a:builder.add_section('airline_'.key, s:get_section(a:winnr, key)) + call a:builder.add_section('airline_'.key, s:get_section(a:context.winnr, key)) if key == 'warning' call a:builder.add_raw('%)') endif @@ -42,7 +46,7 @@ function! airline#extensions#default#apply(builder, context) let active = a:context.active if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) - call build_sections(a:builder, s:layout[0], winnr) + call build_sections(a:builder, a:context, s:layout[0]) else call a:builder.add_section('airline_a', '%f%m ') call a:builder.add_section('airline_c', '') @@ -51,7 +55,7 @@ function! airline#extensions#default#apply(builder, context) call a:builder.split(s:get_section(winnr, 'gutter', '', '')) if airline#util#getwinvar(winnr, 'airline_render_right', 1) - call build_sections(a:builder, s:layout[1], winnr) + call build_sections(a:builder, a:context, s:layout[1]) endif return 1 diff --git a/autoload/airline/extensions/hunks.vim b/autoload/airline/extensions/hunks.vim index 803dfafe..2dc8f328 100644 --- a/autoload/airline/extensions/hunks.vim +++ b/autoload/airline/extensions/hunks.vim @@ -10,14 +10,6 @@ function! s:init() let s:initialized = 1 if get(g:, 'loaded_signify', 0) function! s:get_hunks() - " this is a temporary fix (see #188) - let fname = fnamemodify(bufname('%'), ':p') - if has_key(g:sy, fname) && has_key(g:sy[fname], 'hunks') - if len(g:sy[fname].hunks) == 0 - return [0, 0, 0] - endif - endif - let hunks = sy#repo#get_stats() if hunks[0] >= 0 return hunks diff --git a/autoload/airline/extensions/unite.vim b/autoload/airline/extensions/unite.vim index 6ea42e19..217309ce 100644 --- a/autoload/airline/extensions/unite.vim +++ b/autoload/airline/extensions/unite.vim @@ -4,10 +4,10 @@ function! airline#extensions#unite#apply(...) if &ft == 'unite' call a:1.add_section('airline_a', ' Unite ') - call a:1.add_section('airline_b', ' %{unite#get_context().buffer_name} ') + call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ') call a:1.add_section('airline_c', ' %{unite#get_status_string()} ') call a:1.split() - call a:1.add_section('airline_y', ' %{unite#get_context().real_buffer_name} ') + call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ') return 1 endif endfunction diff --git a/autoload/airline/themes.vim b/autoload/airline/themes.vim index d4ec32b0..0d9158dd 100644 --- a/autoload/airline/themes.vim +++ b/autoload/airline/themes.vim @@ -54,6 +54,12 @@ function! airline#themes#get_highlight2(fg, bg, ...) endfunction function! airline#themes#patch(palette) + for mode in keys(a:palette) + if !has_key(a:palette[mode], 'airline_warning') + let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ] + endif + endfor + " this is a pretty heavy handed, but it works... " basically, look for the 'airline_file' group and copy the bg " colors from 'airline_c' into it. diff --git a/doc/airline.txt b/doc/airline.txt index 86af3eb8..2cb75ec3 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -71,7 +71,7 @@ values): endif endfunction < -* enable/disable usage of patched powerline font symbols > +* enable/disable automatic selection of patched powerline font symbols > let g:airline_powerline_fonts=0 < * define the set of text to display for each mode. > @@ -162,9 +162,10 @@ Note: You must define the dictionary first before setting values: > For more intricate customizations, you can replace the predefined sections with the usual statusline syntax. -Note: Many of these settings can also be controlled with |airline-configuration| -variables, which is useful for sections which by default host more than one -extension. +Note: If you define any section variables it will replace the default values +entirely. If you want to disable only certain parts of a section you can try +using variables defined in the |airline-configuration| or |airline_extensions| +section. > variable names default contents ---------------------------------------------------------------------------- @@ -188,7 +189,7 @@ EXTENSIONS *airline-extensions* Most extensions are enabled by default and lazily loaded when the corresponding plugin (if any) is detected. - *airline-default* +------------------------------------- *airline-default* The default extension understands all of the `g:` variables in the |airline-configuration| section, however it also has some more fine-tuned configuration values that you can use. @@ -204,7 +205,7 @@ configuration values that you can use. " Note: set to an empty dictionary to disable truncation. let g:airline#extensions#default#section_truncate_width = {} < - *airline-bufferline* +------------------------------------- *airline-bufferline* vim-bufferline * enable/disable bufferline integration > @@ -213,7 +214,7 @@ vim-bufferline * determine whether bufferline will overwrite customization variables > let g:airline#extensions#bufferline#overwrite_variables = 1 < - *airline-branch* +------------------------------------- *airline-branch* fugitive.vim lawrencium @@ -223,19 +224,19 @@ lawrencium * change the text for when no branch is detected > let g:airline#extensions#branch#empty_message = '' < - *airline-syntastic* +------------------------------------- *airline-syntastic* syntastic * enable/disable syntastic integration > let g:airline#extensions#syntastic#enabled = 1 < - *airline-tagbar* +------------------------------------- *airline-tagbar* tagbar * enable/disable tagbar integration > let g:airline#extensions#tagbar#enabled = 1 < - *airline-csv* +------------------------------------- *airline-csv* csv.vim * enable/disable csv integration for displaying the current column. > @@ -245,7 +246,7 @@ csv.vim let g:airline#extensions#csv#column_display = 'Number' (default) let g:airline#extensions#csv#column_display = 'Name' < - *airline-hunks* +------------------------------------- *airline-hunks* vim-gitgutter vim-signify @@ -258,7 +259,7 @@ vim-signify * set hunk count symbols. > let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-'] < - *airline-whitespace* +------------------------------------- *airline-whitespace* * enable/disable detection of whitespace errors. > let g:airline#extensions#whitespace#enabled = 1 < @@ -275,7 +276,7 @@ vim-signify let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]' let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]' < - *airline-ctrlp* +------------------------------------- *airline-ctrlp* ctrlp * configure which mode colors should ctrlp window use (takes effect @@ -285,7 +286,7 @@ ctrlp let g:airline#extensions#ctrlp#color_template = 'visual' let g:airline#extensions#ctrlp#color_template = 'replace' < - *airline-virtualenv* +------------------------------------- *airline-virtualenv* virtualenv * enable/disable virtualenv integration > @@ -331,7 +332,7 @@ variable which is used in the absense of a `w:` value. This makes it very easy to override only certain parts of the statusline by only defining window-local variables for a subset of all sections. - *add_statusline_func* +------------------------------------- *add_statusline_func* The following is an example of how you can extend vim-airline to support a new plugin. > function! MyPlugin(...) @@ -344,7 +345,7 @@ new plugin. > endfunction call airline#add_statusline_func('MyPlugin') < - *remove_statusline_func* +------------------------------------- *remove_statusline_func* You can also remove a function as well, which is useful for when you want a temporary override. > call airline#remove_statusline_func('MyPlugin') @@ -385,7 +386,7 @@ values such as whether the statusline is active or not, and the window number. 'active': 'whether the window is active or not', } < - *airline-pipeline-return-codes* +------------------------------------- *airline-pipeline-return-codes* The pipeline accepts various return codes and can be used to determine the next action. The following are the supported codes: > 0 the default, continue on with the next funcref