feat(nvim): center the screen when scrolling on snacks

This commit is contained in:
Sergio Laín 2025-02-16 01:07:08 +01:00
parent 5353d0f0d3
commit 0d0cf7bf49
No known key found for this signature in database
GPG key ID: 51BB28D8B42FB438

View file

@ -227,3 +227,22 @@ map("n", "<leader>ghb", Snacks.git.blame_line, { desc = "Blame Line" })
-- Windows Split
map("n", "<leader>_", "<C-W>s", { desc = "Split Window Below", remap = true })
map("n", "<leader>\\", "<C-W>v", { desc = "Split Window Right", remap = true })
-- Center when scrolling
if Snacks.scroll.enabled then
map("n", "<C-d>", function()
vim.wo.scrolloff = 999
vim.defer_fn(function()
vim.wo.scrolloff = 8
end, 500)
return "<c-d>"
end, { expr = true })
map("n", "<C-u>", function()
vim.wo.scrolloff = 999
vim.defer_fn(function()
vim.wo.scrolloff = 8
end, 500)
return "<c-u>"
end, { expr = true })
end