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
This commit is contained in:
Christian Brabandt 2017-07-30 09:49:21 +02:00
parent 72e5f04f7c
commit 846d85aaa1
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 6 additions and 1 deletions

View File

@ -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