Merge branch 'master' into dev

Conflicts:
	doc/airline.txt
This commit is contained in:
Bailey Ling 2013-09-01 10:28:04 -04:00
commit 0ad6deb832
6 changed files with 34 additions and 32 deletions

View File

@ -26,7 +26,6 @@ function! airline#add_inactive_statusline_func(name)
endfunction endfunction
function! airline#load_theme() function! airline#load_theme()
highlight! default link airline_warning WarningMsg
call airline#highlighter#load_theme() call airline#highlighter#load_theme()
call airline#extensions#load_theme() call airline#extensions#load_theme()
endfunction endfunction

View File

@ -23,14 +23,18 @@ function! s:get_section(winnr, key, ...)
return empty(text) ? '' : prefix.text.suffix return empty(text) ? '' : prefix.text.suffix
endfunction endfunction
function! s:build_sections(builder, keys, winnr) function! s:build_sections(builder, context, keys)
for key in a: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 " i have no idea why the warning section needs special treatment, but it's
" needed to prevent separators from showing up " needed to prevent separators from showing up
if key == 'warning' if key == 'warning'
call a:builder.add_raw('%(') call a:builder.add_raw('%(')
endif 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' if key == 'warning'
call a:builder.add_raw('%)') call a:builder.add_raw('%)')
endif endif
@ -42,7 +46,7 @@ function! airline#extensions#default#apply(builder, context)
let active = a:context.active let active = a:context.active
if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse))
call <sid>build_sections(a:builder, s:layout[0], winnr) call <sid>build_sections(a:builder, a:context, s:layout[0])
else else
call a:builder.add_section('airline_a', '%f%m ') call a:builder.add_section('airline_a', '%f%m ')
call a:builder.add_section('airline_c', '') 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', '', '')) call a:builder.split(s:get_section(winnr, 'gutter', '', ''))
if airline#util#getwinvar(winnr, 'airline_render_right', 1) if airline#util#getwinvar(winnr, 'airline_render_right', 1)
call <sid>build_sections(a:builder, s:layout[1], winnr) call <sid>build_sections(a:builder, a:context, s:layout[1])
endif endif
return 1 return 1

View File

@ -10,14 +10,6 @@ function! s:init()
let s:initialized = 1 let s:initialized = 1
if get(g:, 'loaded_signify', 0) if get(g:, 'loaded_signify', 0)
function! s:get_hunks() 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() let hunks = sy#repo#get_stats()
if hunks[0] >= 0 if hunks[0] >= 0
return hunks return hunks

View File

@ -4,10 +4,10 @@
function! airline#extensions#unite#apply(...) function! airline#extensions#unite#apply(...)
if &ft == 'unite' if &ft == 'unite'
call a:1.add_section('airline_a', ' 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.add_section('airline_c', ' %{unite#get_status_string()} ')
call a:1.split() 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 return 1
endif endif
endfunction endfunction

View File

@ -54,6 +54,12 @@ function! airline#themes#get_highlight2(fg, bg, ...)
endfunction endfunction
function! airline#themes#patch(palette) 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... " this is a pretty heavy handed, but it works...
" basically, look for the 'airline_file' group and copy the bg " basically, look for the 'airline_file' group and copy the bg
" colors from 'airline_c' into it. " colors from 'airline_c' into it.

View File

@ -71,7 +71,7 @@ values):
endif endif
endfunction endfunction
< <
* enable/disable usage of patched powerline font symbols > * enable/disable automatic selection of patched powerline font symbols >
let g:airline_powerline_fonts=0 let g:airline_powerline_fonts=0
< <
* define the set of text to display for each mode. > * 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 For more intricate customizations, you can replace the predefined sections
with the usual statusline syntax. with the usual statusline syntax.
Note: Many of these settings can also be controlled with |airline-configuration| Note: If you define any section variables it will replace the default values
variables, which is useful for sections which by default host more than one entirely. If you want to disable only certain parts of a section you can try
extension. using variables defined in the |airline-configuration| or |airline_extensions|
section.
> >
variable names default contents variable names default contents
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
@ -188,7 +189,7 @@ EXTENSIONS *airline-extensions*
Most extensions are enabled by default and lazily loaded when the Most extensions are enabled by default and lazily loaded when the
corresponding plugin (if any) is detected. corresponding plugin (if any) is detected.
*airline-default* ------------------------------------- *airline-default*
The default extension understands all of the `g:` variables in the The default extension understands all of the `g:` variables in the
|airline-configuration| section, however it also has some more fine-tuned |airline-configuration| section, however it also has some more fine-tuned
configuration values that you can use. 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. " Note: set to an empty dictionary to disable truncation.
let g:airline#extensions#default#section_truncate_width = {} let g:airline#extensions#default#section_truncate_width = {}
< <
*airline-bufferline* ------------------------------------- *airline-bufferline*
vim-bufferline <https://github.com/bling/vim-bufferline> vim-bufferline <https://github.com/bling/vim-bufferline>
* enable/disable bufferline integration > * enable/disable bufferline integration >
@ -213,7 +214,7 @@ vim-bufferline <https://github.com/bling/vim-bufferline>
* determine whether bufferline will overwrite customization variables > * determine whether bufferline will overwrite customization variables >
let g:airline#extensions#bufferline#overwrite_variables = 1 let g:airline#extensions#bufferline#overwrite_variables = 1
< <
*airline-branch* ------------------------------------- *airline-branch*
fugitive.vim <https://github.com/tpope/vim-fugitive> fugitive.vim <https://github.com/tpope/vim-fugitive>
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium> lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
@ -223,19 +224,19 @@ lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
* change the text for when no branch is detected > * change the text for when no branch is detected >
let g:airline#extensions#branch#empty_message = '' let g:airline#extensions#branch#empty_message = ''
< <
*airline-syntastic* ------------------------------------- *airline-syntastic*
syntastic <https://github.com/scrooloose/syntastic> syntastic <https://github.com/scrooloose/syntastic>
* enable/disable syntastic integration > * enable/disable syntastic integration >
let g:airline#extensions#syntastic#enabled = 1 let g:airline#extensions#syntastic#enabled = 1
< <
*airline-tagbar* ------------------------------------- *airline-tagbar*
tagbar <https://github.com/majutsushi/> tagbar <https://github.com/majutsushi/>
* enable/disable tagbar integration > * enable/disable tagbar integration >
let g:airline#extensions#tagbar#enabled = 1 let g:airline#extensions#tagbar#enabled = 1
< <
*airline-csv* ------------------------------------- *airline-csv*
csv.vim <https://github.com/chrisbra/csv.vim> csv.vim <https://github.com/chrisbra/csv.vim>
* enable/disable csv integration for displaying the current column. > * enable/disable csv integration for displaying the current column. >
@ -245,7 +246,7 @@ csv.vim <https://github.com/chrisbra/csv.vim>
let g:airline#extensions#csv#column_display = 'Number' (default) let g:airline#extensions#csv#column_display = 'Number' (default)
let g:airline#extensions#csv#column_display = 'Name' let g:airline#extensions#csv#column_display = 'Name'
< <
*airline-hunks* ------------------------------------- *airline-hunks*
vim-gitgutter <https://github.com/airblade/vim-gitgutter> vim-gitgutter <https://github.com/airblade/vim-gitgutter>
vim-signify <https://github.com/mhinz/vim-signify> vim-signify <https://github.com/mhinz/vim-signify>
@ -258,7 +259,7 @@ vim-signify <https://github.com/mhinz/vim-signify>
* set hunk count symbols. > * set hunk count symbols. >
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-'] let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
< <
*airline-whitespace* ------------------------------------- *airline-whitespace*
* enable/disable detection of whitespace errors. > * enable/disable detection of whitespace errors. >
let g:airline#extensions#whitespace#enabled = 1 let g:airline#extensions#whitespace#enabled = 1
< <
@ -275,7 +276,7 @@ vim-signify <https://github.com/mhinz/vim-signify>
let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]' let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]'
let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]' let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]'
< <
*airline-ctrlp* ------------------------------------- *airline-ctrlp*
ctrlp <https://github.com/kien/ctrlp.vim> ctrlp <https://github.com/kien/ctrlp.vim>
* configure which mode colors should ctrlp window use (takes effect * configure which mode colors should ctrlp window use (takes effect
@ -285,7 +286,7 @@ ctrlp <https://github.com/kien/ctrlp.vim>
let g:airline#extensions#ctrlp#color_template = 'visual' let g:airline#extensions#ctrlp#color_template = 'visual'
let g:airline#extensions#ctrlp#color_template = 'replace' let g:airline#extensions#ctrlp#color_template = 'replace'
< <
*airline-virtualenv* ------------------------------------- *airline-virtualenv*
virtualenv <https://github.com/jmcantrell/vim-virtualenv> virtualenv <https://github.com/jmcantrell/vim-virtualenv>
* enable/disable virtualenv integration > * 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 to override only certain parts of the statusline by only defining window-local
variables for a subset of all sections. 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 The following is an example of how you can extend vim-airline to support a
new plugin. > new plugin. >
function! MyPlugin(...) function! MyPlugin(...)
@ -344,7 +345,7 @@ new plugin. >
endfunction endfunction
call airline#add_statusline_func('MyPlugin') 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 You can also remove a function as well, which is useful for when you want a
temporary override. > temporary override. >
call airline#remove_statusline_func('MyPlugin') 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', '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 The pipeline accepts various return codes and can be used to determine the
next action. The following are the supported codes: > next action. The following are the supported codes: >
0 the default, continue on with the next funcref 0 the default, continue on with the next funcref