mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 13:26:46 +08:00
fix up csv integration so it only applies to csv filetypes
This commit is contained in:
parent
509c9f68a9
commit
f66cb47d29
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user