mode: keep hi setting when switching from 'n' to 'ni'

when using `Ctrl-O` from insert mode, the highlighting currently updates
from insert mode highlighting to normal mode highlighting.
Unfortunately, changing the highlighting can be a bit expansive, so
redefining the highlighting just for one simple command does not make
too much sense.

Instead, keep the insert mode highlighting, because that's kind of like
the major mode Vim is in currently. The mode message uses '(INSERT)' to
distinguish between a "normal" INSERT mode and this temporary INSERT
mode, so it should still be visually be distinguishable.

closes #2217
This commit is contained in:
Christian Brabandt 2020-08-26 22:42:57 +02:00
parent 5d3cfa4045
commit 0f5eedff74
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -221,7 +221,7 @@ function! airline#check_mode(winnr)
elseif l:m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode elseif l:m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode
let l:mode = ['normal'] let l:mode = ['normal']
elseif l:m[0:1] ==# 'ni' elseif l:m[0:1] ==# 'ni'
let l:mode = ['normal'] let l:mode = ['insert']
let l:m = 'ni' let l:m = 'ni'
else else
let l:mode = ['normal'] let l:mode = ['normal']