main: detect some more modes

This commit is contained in:
Christian Brabandt 2018-09-20 10:13:27 +02:00
parent 326b37cf13
commit fce8585239
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 14 additions and 3 deletions

View File

@ -148,7 +148,9 @@ function! airline#check_mode(winnr)
if get(w:, 'airline_active', 1)
let l:m = mode(1)
if l:m[0] ==# "i"
if l:m ==# "i"
let l:mode = ['insert']
elseif l:m[0] ==# "i"
let l:mode = ['insert']
elseif l:m ==# "Rv"
let l:mode =['replace']
@ -160,10 +162,15 @@ function! airline#check_mode(winnr)
let l:mode = ['terminal']
elseif l:m[0] ==# "c"
let l:mode = ['commandline']
elseif l:m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode
let l:mode = ['normal']
elseif l:m[0:1] ==# 'ni'
let l:mode = ['normal']
let l:m = 'ni'
else
let l:mode = ['normal']
endif
if l:m !=# 'Rv'
if index(['Rv', 'no', 'ni', 'ix', 'ic'], l:m) == -1
let l:m = l:m[0]
endif
let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)

View File

@ -36,8 +36,12 @@ function! airline#init#bootstrap()
call s:check_defined('g:airline_mode_map', {})
call extend(g:airline_mode_map, {
\ '__' : '------',
\ 'n' : 'NORMAL',
\ 'i' : 'INSERT',
\ 'ic' : 'INSERT COMPL',
\ 'ix' : 'INSERT COMPL',
\ 'n' : 'NORMAL',
\ 'ni' : '(INSERT)',
\ 'no' : 'OP PENDING',
\ 'R' : 'REPLACE',
\ 'v' : 'VISUAL',
\ 'V' : 'V-LINE',