mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix(animate): avoid lagging when doing a lot of relative resizing
This commit is contained in:
parent
78cf6ee024
commit
6d6203ce85
1 changed files with 39 additions and 0 deletions
|
|
@ -18,6 +18,13 @@ return {
|
||||||
return {
|
return {
|
||||||
resize = {
|
resize = {
|
||||||
timing = animate.gen_timing.linear({ duration = 50, unit = "total" }),
|
timing = animate.gen_timing.linear({ duration = 50, unit = "total" }),
|
||||||
|
-- diable animate when resize acitve
|
||||||
|
-- best effort to avoid lagging when doing a lot of relative resizing
|
||||||
|
subresize = animate.gen_subresize.equal({
|
||||||
|
predicate = function()
|
||||||
|
return not animate.is_active("resize")
|
||||||
|
end,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
scroll = {
|
scroll = {
|
||||||
timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
|
timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
|
||||||
|
|
@ -33,4 +40,36 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
-- because of "VeryLazy" event, "MiniAnimate" module has already been exported
|
||||||
|
-- make LazyVim key maps smoother
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<C-Up>",
|
||||||
|
function()
|
||||||
|
MiniAnimate.execute_after("resize", "resize +2")
|
||||||
|
end,
|
||||||
|
desc = "Increase Window Height",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<C-Down>",
|
||||||
|
function()
|
||||||
|
MiniAnimate.execute_after("resize", "resize -2")
|
||||||
|
end,
|
||||||
|
desc = "Decrease Window Height",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<C-Left>",
|
||||||
|
function()
|
||||||
|
MiniAnimate.execute_after("resize", "vertical resize -2")
|
||||||
|
end,
|
||||||
|
desc = "Decrease Window Width",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<C-Right>",
|
||||||
|
function()
|
||||||
|
MiniAnimate.execute_after("resize", "vertical resize +2")
|
||||||
|
end,
|
||||||
|
desc = "Increase Window Width",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue