centerscroll: use lua to filter buftypes
This commit is contained in:
parent
f3923dd425
commit
6e1060fbaf
|
@ -1,5 +0,0 @@
|
|||
" from https://vi.stackexchange.com/a/26055
|
||||
augroup KeepCentered
|
||||
autocmd!
|
||||
autocmd CursorMoved * normal! zz
|
||||
augroup END
|
16
plugin/centerscroll.lua
Normal file
16
plugin/centerscroll.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
-- " 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", {
|
||||
group = "KeepCentered",
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.o.buftype == '' then
|
||||
vim.cmd([[normal! zz]])
|
||||
end
|
||||
end,
|
||||
})
|
Loading…
Reference in a new issue