mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-01-08 20:43:22 +08:00
support multiple accents in the same section (#203).
This commit is contained in:
@@ -23,12 +23,17 @@ function! s:prototype.add_section(group, contents)
|
||||
let self._line .= '%#'.a:group.'#'
|
||||
endif
|
||||
|
||||
let accent = matchstr(a:contents, 'airline_accent_\zs[^#]*\ze')
|
||||
let contents = substitute(a:contents, 'airline_accent', a:group, 'g')
|
||||
if contents != a:contents
|
||||
let contents = []
|
||||
let content_parts = split(a:contents, 'airline_accent')
|
||||
for cpart in content_parts
|
||||
let accent = matchstr(cpart, '_\zs[^#]*\ze')
|
||||
call airline#highlighter#add_accent(a:group, accent)
|
||||
endif
|
||||
let self._line .= contents
|
||||
call add(contents, cpart)
|
||||
endfor
|
||||
let line = join(contents, a:group)
|
||||
let line = substitute(line, '__restore__', a:group, 'g')
|
||||
|
||||
let self._line .= line
|
||||
let self._curgroup = a:group
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@ function! s:create(parts, append)
|
||||
endif
|
||||
|
||||
let val .= partval
|
||||
if exists('part.accent')
|
||||
let val .= '%#__restore__#'
|
||||
endif
|
||||
let _ .= val
|
||||
endfor
|
||||
return _
|
||||
|
||||
Reference in New Issue
Block a user