autoload: handle bufnr as string explicitly
This is some preparational work for evetually merging the vim9 script feature. Also while at it, remove those nasty `l:` prefixes
This commit is contained in:
parent
db78454a03
commit
23e20bfada
|
@ -203,66 +203,66 @@ function! airline#check_mode(winnr)
|
|||
let context = s:contexts[a:winnr]
|
||||
|
||||
if get(w:, 'airline_active', 1)
|
||||
let l:m = mode(1)
|
||||
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']
|
||||
elseif l:m[0] ==# "R"
|
||||
let l:mode = ['replace']
|
||||
elseif l:m[0] =~# '\v(v|V||s|S|)'
|
||||
let l:mode = ['visual']
|
||||
elseif l:m ==# "t"
|
||||
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 = ['insert']
|
||||
let l:m = 'ni'
|
||||
let m = mode(1)
|
||||
if m ==# "i"
|
||||
let mode = ['insert']
|
||||
elseif m[0] ==# "i"
|
||||
let mode = ['insert']
|
||||
elseif m ==# "Rv"
|
||||
let mode =['replace']
|
||||
elseif m[0] ==# "R"
|
||||
let mode = ['replace']
|
||||
elseif m[0] =~# '\v(v|V||s|S|)'
|
||||
let mode = ['visual']
|
||||
elseif m ==# "t"
|
||||
let mode = ['terminal']
|
||||
elseif m[0] ==# "c"
|
||||
let mode = ['commandline']
|
||||
elseif m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode
|
||||
let mode = ['normal']
|
||||
elseif m[0:1] ==# 'ni'
|
||||
let mode = ['insert']
|
||||
let m = 'ni'
|
||||
else
|
||||
let l:mode = ['normal']
|
||||
let mode = ['normal']
|
||||
endif
|
||||
if exists("*VMInfos") && !empty(VMInfos())
|
||||
" Vim plugin Multiple Cursors https://github.com/mg979/vim-visual-multi
|
||||
let l:m = 'multi'
|
||||
let m = 'multi'
|
||||
endif
|
||||
if index(['Rv', 'no', 'ni', 'ix', 'ic', 'multi'], l:m) == -1
|
||||
let l:m = l:m[0]
|
||||
if index(['Rv', 'no', 'ni', 'ix', 'ic', 'multi'], m) == -1
|
||||
let m = m[0]
|
||||
endif
|
||||
let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
|
||||
let w:airline_current_mode = get(g:airline_mode_map, m, m)
|
||||
else
|
||||
let l:mode = ['inactive']
|
||||
let mode = ['inactive']
|
||||
let w:airline_current_mode = get(g:airline_mode_map, '__')
|
||||
endif
|
||||
|
||||
if g:airline_detect_modified && &modified
|
||||
call add(l:mode, 'modified')
|
||||
call add(mode, 'modified')
|
||||
endif
|
||||
|
||||
if g:airline_detect_paste && &paste
|
||||
call add(l:mode, 'paste')
|
||||
call add(mode, 'paste')
|
||||
endif
|
||||
|
||||
if g:airline_detect_crypt && exists("+key") && !empty(&key)
|
||||
call add(l:mode, 'crypt')
|
||||
call add(mode, 'crypt')
|
||||
endif
|
||||
|
||||
if g:airline_detect_spell && &spell
|
||||
call add(l:mode, 'spell')
|
||||
call add(mode, 'spell')
|
||||
endif
|
||||
|
||||
if &readonly || ! &modifiable
|
||||
call add(l:mode, 'readonly')
|
||||
call add(mode, 'readonly')
|
||||
endif
|
||||
|
||||
let mode_string = join(l:mode)
|
||||
let mode_string = join(mode)
|
||||
if get(w:, 'airline_lastmode', '') != mode_string
|
||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode, context.bufnr)
|
||||
call airline#highlighter#highlight_modified_inactive(string(context.bufnr))
|
||||
call airline#highlighter#highlight(mode, string(context.bufnr))
|
||||
call airline#util#doautocmd('AirlineModeChanged')
|
||||
let w:airline_lastmode = mode_string
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue