2013-08-30 21:56:12 +00:00
|
|
|
" MIT License. Copyright (c) 2013 Bailey Ling.
|
|
|
|
" vim: et ts=2 sts=2 sw=2
|
|
|
|
|
2013-08-31 21:42:09 +00:00
|
|
|
call airline#init#bootstrap()
|
|
|
|
|
2013-09-01 16:07:46 +00:00
|
|
|
function! s:create(parts, append)
|
|
|
|
let _ = ''
|
|
|
|
for idx in range(len(a:parts))
|
|
|
|
let part = airline#parts#get(a:parts[idx])
|
|
|
|
|
|
|
|
let val = ''
|
|
|
|
if exists('part.highlight')
|
|
|
|
let val .= '%#'.(part.highlight).'#'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if exists('part.function')
|
|
|
|
let func = (part.function).'()'
|
|
|
|
elseif exists('part.text')
|
|
|
|
let func = '"'.(part.text).'"'
|
|
|
|
else
|
|
|
|
if a:append > 0 && idx != 0
|
|
|
|
let val .= ' '.g:airline_left_alt_sep.' '
|
|
|
|
endif
|
|
|
|
if a:append < 0 && idx != 0
|
|
|
|
let val = ' '.g:airline_right_alt_sep.' '.val
|
|
|
|
endif
|
|
|
|
if exists('part.raw')
|
|
|
|
let _ .= val.(part.raw)
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
let _ .= val.a:parts[idx]
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
let minwidth = get(part, 'minwidth', 0)
|
|
|
|
|
|
|
|
if a:append > 0 && idx != 0
|
|
|
|
let val .= printf('%%{airline#util#append(%s,%s)}', func, minwidth)
|
|
|
|
elseif a:append < 0 && idx != len(a:parts) - 1
|
|
|
|
let val .= printf('%%{airline#util#prepend(%s,%s)}', func, minwidth)
|
|
|
|
else
|
|
|
|
let val .= printf('%%{airline#util#wrap(%s,%s)}', func, minwidth)
|
|
|
|
endif
|
|
|
|
let _ .= val
|
|
|
|
endfor
|
|
|
|
return _
|
2013-08-30 21:56:12 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#section#create(parts)
|
2013-09-01 16:07:46 +00:00
|
|
|
return s:create(a:parts, 0)
|
2013-08-30 21:56:12 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#section#create_left(parts)
|
2013-09-01 16:07:46 +00:00
|
|
|
return s:create(a:parts, 1)
|
2013-08-30 21:56:12 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#section#create_right(parts)
|
2013-09-01 16:07:46 +00:00
|
|
|
return s:create(a:parts, -1)
|
2013-08-30 21:56:12 +00:00
|
|
|
endfunction
|
|
|
|
|