Skip to content

Commit 1590e18

Browse files
committed
Delay one eventloop roundtrip for lualine
The whole lualine thing is way too cursed. Our workarounds work much better if we delay the update until lualine has set all local statuslines. The clearstl option is still a bit broken with lualine though. Also see commit 14cd2d4
1 parent 6e624f0 commit 1590e18

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

autoload/tpipeline.vim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ func tpipeline#build_hooks()
3333
endif
3434

3535
if empty(g:tpipeline_statusline) && !g:tpipeline_tabline
36-
if g:tpipeline_clearstl
37-
if tpipeline#lualine#is_lualine()
38-
au OptionSet statusline if v:option_type == 'local' | call tpipeline#lualine#clear_all_stl() | endif
39-
au ModeChanged * call tpipeline#lualine#clear_all_stl()
40-
endif
36+
if tpipeline#lualine#is_lualine()
37+
au OptionSet statusline call tpipeline#lualine#delay_eval()
38+
elseif g:tpipeline_clearstl
4139
au OptionSet statusline if v:option_type == 'global' | call tpipeline#util#clear_stl() | endif
4240
endif
4341
au OptionSet statusline call tpipeline#update()

autoload/tpipeline/lualine.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,15 @@ func tpipeline#lualine#clear_all_stl()
88
noa call win_execute(win_getid(i), 'setlocal stl<')
99
endfor
1010
endfunc
11+
12+
func tpipeline#lualine#fix_stl()
13+
noa let g:tpipeline_statusline = getwinvar(win_getid(), '&stl')
14+
if g:tpipeline_clearstl
15+
call tpipeline#lualine#clear_all_stl()
16+
endif
17+
call tpipeline#update()
18+
endfunc
19+
20+
func tpipeline#lualine#delay_eval()
21+
let s:timer = timer_start(0, {-> tpipeline#lualine#fix_stl()})
22+
endfunc

0 commit comments

Comments
 (0)