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:
Christian Brabandt 2021-05-07 22:43:00 +02:00
parent db78454a03
commit 23e20bfada
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 34 additions and 34 deletions

View File

@ -203,66 +203,66 @@ function! airline#check_mode(winnr)
let context = s:contexts[a:winnr] let context = s:contexts[a:winnr]
if get(w:, 'airline_active', 1) if get(w:, 'airline_active', 1)
let l:m = mode(1) let m = mode(1)
if l:m ==# "i" if m ==# "i"
let l:mode = ['insert'] let mode = ['insert']
elseif l:m[0] ==# "i" elseif m[0] ==# "i"
let l:mode = ['insert'] let mode = ['insert']
elseif l:m ==# "Rv" elseif m ==# "Rv"
let l:mode =['replace'] let mode =['replace']
elseif l:m[0] ==# "R" elseif m[0] ==# "R"
let l:mode = ['replace'] let mode = ['replace']
elseif l:m[0] =~# '\v(v|V||s|S|)' elseif m[0] =~# '\v(v|V||s|S|)'
let l:mode = ['visual'] let mode = ['visual']
elseif l:m ==# "t" elseif m ==# "t"
let l:mode = ['terminal'] let mode = ['terminal']
elseif l:m[0] ==# "c" elseif m[0] ==# "c"
let l:mode = ['commandline'] let mode = ['commandline']
elseif l:m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode elseif m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode
let l:mode = ['normal'] let mode = ['normal']
elseif l:m[0:1] ==# 'ni' elseif m[0:1] ==# 'ni'
let l:mode = ['insert'] let mode = ['insert']
let l:m = 'ni' let m = 'ni'
else else
let l:mode = ['normal'] let mode = ['normal']
endif endif
if exists("*VMInfos") && !empty(VMInfos()) if exists("*VMInfos") && !empty(VMInfos())
" Vim plugin Multiple Cursors https://github.com/mg979/vim-visual-multi " Vim plugin Multiple Cursors https://github.com/mg979/vim-visual-multi
let l:m = 'multi' let m = 'multi'
endif endif
if index(['Rv', 'no', 'ni', 'ix', 'ic', 'multi'], l:m) == -1 if index(['Rv', 'no', 'ni', 'ix', 'ic', 'multi'], m) == -1
let l:m = l:m[0] let m = m[0]
endif 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 else
let l:mode = ['inactive'] let mode = ['inactive']
let w:airline_current_mode = get(g:airline_mode_map, '__') let w:airline_current_mode = get(g:airline_mode_map, '__')
endif endif
if g:airline_detect_modified && &modified if g:airline_detect_modified && &modified
call add(l:mode, 'modified') call add(mode, 'modified')
endif endif
if g:airline_detect_paste && &paste if g:airline_detect_paste && &paste
call add(l:mode, 'paste') call add(mode, 'paste')
endif endif
if g:airline_detect_crypt && exists("+key") && !empty(&key) if g:airline_detect_crypt && exists("+key") && !empty(&key)
call add(l:mode, 'crypt') call add(mode, 'crypt')
endif endif
if g:airline_detect_spell && &spell if g:airline_detect_spell && &spell
call add(l:mode, 'spell') call add(mode, 'spell')
endif endif
if &readonly || ! &modifiable if &readonly || ! &modifiable
call add(l:mode, 'readonly') call add(mode, 'readonly')
endif endif
let mode_string = join(l:mode) let mode_string = join(mode)
if get(w:, 'airline_lastmode', '') != mode_string if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr) call airline#highlighter#highlight_modified_inactive(string(context.bufnr))
call airline#highlighter#highlight(l:mode, context.bufnr) call airline#highlighter#highlight(mode, string(context.bufnr))
call airline#util#doautocmd('AirlineModeChanged') call airline#util#doautocmd('AirlineModeChanged')
let w:airline_lastmode = mode_string let w:airline_lastmode = mode_string
endif endif