spacevim/bundle/vim-airline/autoload/airline/extensions/vimtex.vim
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

85 lines
2.8 KiB
VimL

" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
" Plugin: https://github.com/lervag/vimtex
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:spc = g:airline_symbols.space
function! s:SetDefault(var, val)
if !exists(a:var)
execute 'let ' . a:var . '=' . string(a:val)
endif
endfunction
" Left and right delimiters (added only when status string is not empty)
call s:SetDefault( 'g:airline#extensions#vimtex#left', "{")
call s:SetDefault( 'g:airline#extensions#vimtex#right', "}")
" The current tex file is the main project file
call s:SetDefault( 'g:airline#extensions#vimtex#main', "" )
"
" The current tex file is a subfile of the project
" and the compilation is set for the main file
call s:SetDefault( 'g:airline#extensions#vimtex#sub_main', "m")
"
" The current tex file is a subfile of the project
" and the compilation is set for this subfile
call s:SetDefault( 'g:airline#extensions#vimtex#sub_local', "l")
"
" Compilation is running and continuous compilation is off
call s:SetDefault( 'g:airline#extensions#vimtex#compiled', "c₁")
" Compilation is running and continuous compilation is on
call s:SetDefault( 'g:airline#extensions#vimtex#continuous', "c")
" Viewer is opened
call s:SetDefault( 'g:airline#extensions#vimtex#viewer', "v")
function! airline#extensions#vimtex#init(ext)
call airline#parts#define_raw('vimtex', '%{airline#extensions#vimtex#get_scope()}')
call a:ext.add_statusline_func('airline#extensions#vimtex#apply')
endfunction
function! airline#extensions#vimtex#apply(...)
if exists("b:vimtex")
let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x)
let w:airline_section_x.=s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#vimtex#get_scope()}'
endif
endfunction
function! airline#extensions#vimtex#get_scope()
let l:status = ''
let vt_local = get(b:, 'vimtex_local', {})
if empty(vt_local)
let l:status .= g:airline#extensions#vimtex#main
else
if get(vt_local, 'active')
let l:status .= g:airline#extensions#vimtex#sub_local
else
let l:status .= g:airline#extensions#vimtex#sub_main
endif
endif
if get(get(get(b:, 'vimtex', {}), 'viewer', {}), 'xwin_id')
let l:status .= g:airline#extensions#vimtex#viewer
endif
let l:compiler = get(get(b:, 'vimtex', {}), 'compiler', {})
if !empty(l:compiler)
if has_key(l:compiler, 'is_running') && b:vimtex.compiler.is_running()
if get(l:compiler, 'continuous')
let l:status .= g:airline#extensions#vimtex#continuous
else
let l:status .= g:airline#extensions#vimtex#compiled
endif
endif
endif
if !empty(l:status)
let l:status = g:airline#extensions#vimtex#left . l:status . g:airline#extensions#vimtex#right
endif
return l:status
endfunction