nvim: statusline: Use the new auto command API

This commit is contained in:
Sanchayan Maity 2022-03-04 18:00:54 +05:30
parent 0246931b56
commit 39acdb222f

View file

@ -238,19 +238,26 @@ _G.Statusline = setmetatable(M, {
end, end,
}) })
cmd [[ api.nvim_create_augroup("Statusline", {clear = true})
augroup Statusline api.nvim_create_autocmd({"WinEnter", "BufEnter"}, {
au! group = "Statusline",
au WinEnter,BufEnter * setlocal statusline=%!v:lua.Statusline('active') pattern = "*",
au WinLeave,BufLeave * setlocal statusline=%!v:lua.Statusline('inactive') command = "setlocal statusline=%!v:lua.Statusline('active')"
augroup END })
]] api.nvim_create_autocmd({"WinLeave" , "BufLeave"}, {
group = "Statusline",
pattern = "*",
command = "setlocal statusline=%!v:lua.Statusline('inactive')"
})
cmd [[ api.nvim_create_augroup("HideStatusline", {clear = true})
augroup HideStatusline api.nvim_create_autocmd({"TermOpen", "TermEnter"}, {
au! group = "HideStatusline",
au! FileType fzf,toggleterm pattern = "*",
au FileType fzf,toggleterm set laststatus=0 noshowmode noruler command = "set laststatus=0 noshowmode noruler"
\| au BufLeave <buffer> set laststatus=2 showmode ruler })
augroup END api.nvim_create_autocmd({"TermLeave"}, {
]] group = "HideStatusline",
pattern = "*",
command = "set laststatus=2 showmode ruler"
})