support for prefixing with a highlight group.
This commit is contained in:
parent
d268744077
commit
500ecf7cd0
@ -3,17 +3,23 @@
|
||||
|
||||
function! s:get_val(key, append)
|
||||
let part = airline#parts#get(a:key)
|
||||
|
||||
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).'"'
|
||||
elseif exists('part.raw')
|
||||
return part.raw
|
||||
return val.(part.raw)
|
||||
else
|
||||
return a:key
|
||||
endif
|
||||
|
||||
let val = ''
|
||||
|
||||
if a:append > 0
|
||||
let val .= '%{airline#util#append('.func.')}'
|
||||
elseif a:append < 0
|
||||
|
@ -8,6 +8,10 @@ describe 'section'
|
||||
call airline#parts#define_text('text', 'text')
|
||||
call airline#parts#define_raw('raw', 'raw')
|
||||
call airline#parts#define_function('func', 'SectionSpec')
|
||||
call airline#parts#define('hi', {
|
||||
\ 'raw': 'hello',
|
||||
\ 'highlight': 'hlgroup',
|
||||
\ })
|
||||
end
|
||||
|
||||
it 'should create sections with no separators'
|
||||
@ -24,5 +28,10 @@ describe 'section'
|
||||
let s = airline#section#create_right(['text', 'text'])
|
||||
Expect s == '%{airline#util#prepend("text")}%{"text"}'
|
||||
end
|
||||
|
||||
it 'should prefix with highlight group if provided'
|
||||
let s = airline#section#create(['hi'])
|
||||
Expect s == '%#hlgroup#hello'
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user