fix up csv integration so it only applies to csv filetypes

This commit is contained in:
Bailey Ling 2013-08-13 21:52:31 -04:00
parent 509c9f68a9
commit f66cb47d29
2 changed files with 10 additions and 8 deletions

View File

@ -1,20 +1,22 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#csv#get_statusline()
function! airline#extensions#csv#apply()
if &ft ==# "csv" && exists("*CSV_WCol")
if get(g:, 'airline#extensions#csv#column_identify', '') ==# 'Name'
return '['.CSV_WCol('Name').CSV_WCol().']'
let column = '['.CSV_WCol('Name').CSV_WCol().']'
else
return '['.CSV_WCol().']'
let column = '['.CSV_WCol().']'
endif
else
return ''
if !exists('w:airline_section_gutter')
let w:airline_section_gutter = ''
endif
let w:airline_section_gutter .= g:airline_left_alt_sep.' '.column
endif
endfunction
function! airline#extensions#csv#init(ext)
call a:ext.add_statusline_funcref(function('airline#extensions#csv#get_statusline'))
let g:airline_section_c .= ' '.g:airline_left_alt_sep.' %{airline#extensions#csv#get_statusline()}'
call a:ext.add_statusline_funcref(function('airline#extensions#csv#apply'))
endfunction

View File

@ -183,7 +183,7 @@ sections which by default host more than one extension.
let g:airline_section_a (the mode/paste indicator)
let g:airline_section_b (the fugitive/lawrencium branch indicator)
let g:airline_section_c (bufferline or filename)
let g:airline_section_gutter
let g:airline_section_gutter (csv)
let g:airline_section_x (tagbar, filetype)
let g:airline_section_y (fileencoding, fileformat)
let g:airline_section_z (percentage, line number, column number)