nvim: statusline: Use the new auto command API
This commit is contained in:
parent
0246931b56
commit
39acdb222f
1 changed files with 22 additions and 15 deletions
|
@ -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"
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue