diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 09fe3da..1857dfd 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -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 diff --git a/autoload/airline/extensions/term.vim b/autoload/airline/extensions/term.vim index 5e562e2..1cbab78 100644 --- a/autoload/airline/extensions/term.vim +++ b/autoload/airline/extensions/term.vim @@ -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