Better way to check for terminal buffer

This commit is contained in:
Christian Brabandt 2017-07-30 18:57:05 +02:00
parent d54613d2dd
commit 0c307d5f73
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 4 additions and 6 deletions

View File

@ -149,22 +149,20 @@ function! airline#check_mode(winnr)
let s:airline_run += 1
let context = s:contexts[a:winnr]
let is_term = 0
if exists("*term_list")
let is_term = index(term_list(), bufnr('')) > -1
endif
if get(w:, 'airline_active', 1)
let l:m = mode()
if exists("*term_list") && index(term_list(), bufnr('')) > -1
let l:m = "t"
endif
if l:m ==# "i"
let l:mode = ['insert']
elseif l:m ==# "R"
let l:mode = ['replace']
elseif l:m =~# '\v(v|V||s|S|)'
let l:mode = ['visual']
elseif l:m ==# "t" || is_term
elseif l:m ==# "t"
let l:mode = ['terminal']
let l:m = 't'
else
let l:mode = ['normal']
endif