✨ feat(nvim): center the screen when scrolling on snacks
This commit is contained in:
parent
5353d0f0d3
commit
0d0cf7bf49
1 changed files with 19 additions and 0 deletions
|
@ -227,3 +227,22 @@ map("n", "<leader>ghb", Snacks.git.blame_line, { desc = "Blame Line" })
|
||||||
-- Windows Split
|
-- Windows Split
|
||||||
map("n", "<leader>_", "<C-W>s", { desc = "Split Window Below", remap = true })
|
map("n", "<leader>_", "<C-W>s", { desc = "Split Window Below", remap = true })
|
||||||
map("n", "<leader>\\", "<C-W>v", { desc = "Split Window Right", 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue