mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-27 07:54:44 +02:00
Add a terminal statusline function for vim
This commit is contained in:
parent
bd613e69b6
commit
0ad4f97c1a
@ -49,7 +49,9 @@ function! s:prototype.build() dict
|
|||||||
let contents = section[1]
|
let contents = section[1]
|
||||||
let pgroup = prev_group
|
let pgroup = prev_group
|
||||||
let prev_group = s:get_prev_group(self._sections, i)
|
let prev_group = s:get_prev_group(self._sections, i)
|
||||||
if group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active
|
||||||
|
let group = 'airline_term'
|
||||||
|
elseif group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
||||||
let group = 'airline_c'. self._context.bufnr
|
let group = 'airline_c'. self._context.bufnr
|
||||||
elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
||||||
let prev_group = 'airline_c'. self._context.bufnr
|
let prev_group = 'airline_c'. self._context.bufnr
|
||||||
|
@ -153,6 +153,11 @@ function! airline#extensions#load()
|
|||||||
call add(loaded_ext, 'netrw')
|
call add(loaded_ext, 'netrw')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if has("terminal")
|
||||||
|
call airline#extensions#term#init(s:ext)
|
||||||
|
call add(loaded_ext, 'term')
|
||||||
|
endif
|
||||||
|
|
||||||
if get(g:, 'airline#extensions#ycm#enabled', 0)
|
if get(g:, 'airline#extensions#ycm#enabled', 0)
|
||||||
call airline#extensions#ycm#init(s:ext)
|
call airline#extensions#ycm#init(s:ext)
|
||||||
call add(loaded_ext, 'ycm')
|
call add(loaded_ext, 'ycm')
|
||||||
|
32
autoload/airline/extensions/term.vim
Normal file
32
autoload/airline/extensions/term.vim
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
" MIT License.
|
||||||
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
|
function! airline#extensions#term#apply(...)
|
||||||
|
if &buftype == 'terminal'
|
||||||
|
let spc = g:airline_symbols.space
|
||||||
|
|
||||||
|
call a:1.add_section('airline_a', spc.'TERMINAL'.spc)
|
||||||
|
call a:1.add_section('airline_b', '')
|
||||||
|
call a:1.add_section('airline_c', spc.'%f')
|
||||||
|
call a:1.split()
|
||||||
|
call a:1.add_section('airline_y', '')
|
||||||
|
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
|
||||||
|
redraw!
|
||||||
|
return 1
|
||||||
|
"let w:airline_section_b = ''
|
||||||
|
"let w:airline_section_x = ''
|
||||||
|
" Here we define a new part for the plugin. This allows users to place this
|
||||||
|
" extension in arbitrary locations.
|
||||||
|
"call airline#parts#define_raw('term', '%{airline#extensions#term#get_highlight()}')
|
||||||
|
|
||||||
|
" Next up we add a funcref so that we can run some code prior to the
|
||||||
|
" statusline getting modifed.
|
||||||
|
"call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! airline#extensions#term#init(ext)
|
||||||
|
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||||
|
endfunction
|
@ -44,6 +44,10 @@ function! airline#themes#patch(palette)
|
|||||||
if !has_key(a:palette[mode], 'airline_error')
|
if !has_key(a:palette[mode], 'airline_error')
|
||||||
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
|
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
|
||||||
endif
|
endif
|
||||||
|
if !has_key(a:palette[mode], 'airline_term')
|
||||||
|
"let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
|
||||||
|
let a:palette[mode]['airline_term'] = airline#highlighter#get_highlight('airline_c')
|
||||||
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let a:palette.accents = get(a:palette, 'accents', {})
|
let a:palette.accents = get(a:palette, 'accents', {})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user