From 846d85aaa1eb6c0462a7bc90c822b1bb2a081cd2 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sun, 30 Jul 2017 09:49:21 +0200 Subject: [PATCH] main: support for Vims terminal mode Currently this is a hack, to get terminal mode from Vim. However there is no better solution yet, since the API is not stable here. Until then, just use the hack with index(term_list(), bufnr('')) > -1 --- autoload/airline.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/airline.vim b/autoload/airline.vim index d54fe036..585a5e4c 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -149,6 +149,10 @@ function! airline#check_mode(winnr) let s:airline_run += 1 let context = s:contexts[a:winnr] + let is_term = 0 + if has("terminal") + let is_term = index(term_list(), bufnr('')) > -1 + endif if get(w:, 'airline_active', 1) let l:m = mode() @@ -158,8 +162,9 @@ function! airline#check_mode(winnr) let l:mode = ['replace'] elseif l:m =~# '\v(v|V||s|S|)' let l:mode = ['visual'] - elseif l:m ==# "t" + elseif l:m ==# "t" || is_term let l:mode = ['terminal'] + let l:m = 't' else let l:mode = ['normal'] endif