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