unbreak csv extension. redefine gutter as the middle.

This commit is contained in:
Bailey Ling 2013-08-14 03:53:29 +00:00
parent b7131d8b51
commit 6a0163104a
3 changed files with 18 additions and 12 deletions

View File

@ -89,14 +89,12 @@ function! airline#get_statusline(winnr, active)
let sl.=l:info_sep_color
let sl.=g:airline_left_sep
let sl.=l:status_color.'%<'.s:get_section(a:winnr, 'c')
let sl.=' '.l:file_flag_color."%(%{&ro ? g:airline_readonly_symbol : ''}%)".l:status_color
let sl.=s:get_section(a:winnr, 'gutter', '', '')
let sl.=l:status_color
let sl.=' '.l:file_flag_color."%(%{&ro ? g:airline_readonly_symbol : ''}%)"
else
let sl.=l:status_color.' %f%m'
endif
let sl.=l:status_color.s:get_section(a:winnr, 'gutter', '', '').l:status_color
if s:getwinvar(a:winnr, 'airline_render_right', 1)
let sl.='%='
let sl.=s:get_section(a:winnr, 'x')
let sl.=l:info_sep_color
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep

View File

@ -5,18 +5,26 @@ if !exists('g:airline#extensions#csv#column_display')
let g:airline#extensions#csv#column_display = 'Number'
endif
function! airline#extensions#csv#apply()
if &ft ==# "csv" && exists("*CSV_WCol")
if get(g:, 'airline#extensions#csv#column_display', '') ==# 'Name'
let column = '['.CSV_WCol('Name').CSV_WCol().']'
function! airline#extensions#csv#get_statusline()
if exists('*CSV_WCol')
if g:airline#extensions#csv#column_display ==# 'Name'
return '['.CSV_WCol('Name').CSV_WCol().']'
else
let column = '['.CSV_WCol().']'
return '['.CSV_WCol().']'
endif
endif
return ''
endfunction
function! airline#extensions#csv#apply()
if &ft ==# "csv"
if !exists('w:airline_section_gutter')
let w:airline_section_gutter = ''
let w:airline_section_gutter = '%='
endif
let w:airline_section_gutter .= g:airline_left_alt_sep.' '.column
let w:airline_section_gutter =
\ g:airline_left_alt_sep
\ .' %{airline#extensions#csv#get_statusline()}'
\ .w:airline_section_gutter
endif
endfunction

View File

@ -54,7 +54,7 @@ call s:check_defined('g:airline_mode_map', {
call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}')
call s:check_defined('g:airline_section_b', '%{get(w:, "airline_current_branch", "")}')
call s:check_defined('g:airline_section_c', '%f%m')
call s:check_defined('g:airline_section_gutter', '')
call s:check_defined('g:airline_section_gutter', '%=')
call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}")
call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}")
call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c')