mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-26 10:13:42 +08:00
terminal: return proper terminal name
This commit is contained in:
parent
f9ccb57e76
commit
bc63a60b0f
|
@ -149,7 +149,7 @@ function! airline#extensions#load()
|
|||
call add(s:loaded_ext, 'netrw')
|
||||
endif
|
||||
|
||||
if has("terminal")
|
||||
if has("terminal") || has('nvim')
|
||||
call airline#extensions#term#init(s:ext)
|
||||
call add(s:loaded_ext, 'term')
|
||||
endif
|
||||
|
|
|
@ -10,7 +10,7 @@ function! airline#extensions#term#apply(...)
|
|||
let name=get(g:airline_mode_map, 't', 't')
|
||||
call a:1.add_section('airline_a', spc.name.spc)
|
||||
call a:1.add_section('airline_b', '')
|
||||
call a:1.add_section('airline_term', spc.'%f')
|
||||
call a:1.add_section('airline_term', spc.s:termname())
|
||||
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']))
|
||||
|
@ -18,6 +18,16 @@ function! airline#extensions#term#apply(...)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! s:termname()
|
||||
let bufname = bufname('%')
|
||||
if has('nvim')
|
||||
return matchstr(bufname, 'term.*:\zs.*')
|
||||
else
|
||||
" get rid of leading '!'
|
||||
return bufname[1:]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||
endfunction
|
||||
|
|
Loading…
Reference in New Issue
Block a user