mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-09 21:46:39 +08:00
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:
@@ -149,6 +149,10 @@ function! airline#check_mode(winnr)
|
|||||||
let s:airline_run += 1
|
let s:airline_run += 1
|
||||||
|
|
||||||
let context = s:contexts[a:winnr]
|
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)
|
if get(w:, 'airline_active', 1)
|
||||||
let l:m = mode()
|
let l:m = mode()
|
||||||
@@ -158,8 +162,9 @@ function! airline#check_mode(winnr)
|
|||||||
let l:mode = ['replace']
|
let l:mode = ['replace']
|
||||||
elseif l:m =~# '\v(v|V||s|S|)'
|
elseif l:m =~# '\v(v|V||s|S|)'
|
||||||
let l:mode = ['visual']
|
let l:mode = ['visual']
|
||||||
elseif l:m ==# "t"
|
elseif l:m ==# "t" || is_term
|
||||||
let l:mode = ['terminal']
|
let l:mode = ['terminal']
|
||||||
|
let l:m = 't'
|
||||||
else
|
else
|
||||||
let l:mode = ['normal']
|
let l:mode = ['normal']
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user