nvim/plugin/centerscroll.lua

17 lines
410 B
Lua
Raw Normal View History

-- " from https://vi.stackexchange.com/a/26055
-- augroup KeepCentered
-- autocmd!
-- autocmd CursorMoved * if &buftype == '' | normal! zz | endif
-- augroup END
vim.api.nvim_create_augroup("KeepCentered", { clear = true })
vim.api.nvim_create_autocmd("CursorMoved", {
2024-03-15 14:15:26 +00:00
group = "KeepCentered",
pattern = '*',
callback = function()
if vim.o.buftype == '' then
vim.cmd([[normal! zz]])
end
end,
})