mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-24 22:45:12 +02: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')
|
call add(s:loaded_ext, 'netrw')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has("terminal")
|
if has("terminal") || has('nvim')
|
||||||
call airline#extensions#term#init(s:ext)
|
call airline#extensions#term#init(s:ext)
|
||||||
call add(s:loaded_ext, 'term')
|
call add(s:loaded_ext, 'term')
|
||||||
endif
|
endif
|
||||||
|
@ -10,7 +10,7 @@ function! airline#extensions#term#apply(...)
|
|||||||
let name=get(g:airline_mode_map, 't', 't')
|
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_a', spc.name.spc)
|
||||||
call a:1.add_section('airline_b', '')
|
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.split()
|
||||||
call a:1.add_section('airline_y', '')
|
call a:1.add_section('airline_y', '')
|
||||||
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
|
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
|
||||||
@ -18,6 +18,16 @@ function! airline#extensions#term#apply(...)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
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)
|
function! airline#extensions#term#init(ext)
|
||||||
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user