Skip to content

Commit

Permalink
feat(toc): don't scroll content window when switching to toc
Browse files Browse the repository at this point in the history
  • Loading branch information
champignoom authored and vhyrro committed Dec 27, 2023
1 parent a51abd5 commit c4fc7e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/neorg/modules/core/qol/toc/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ module.on_event = function(event)

-- Sync cursor: ToC -> content
if module.config.public.sync_cursorline then
-- Ignore the first (fake) CursorMoved coming together with BufEnter of the ToC buffer
vim.api.nvim_create_autocmd("BufEnter", {
buffer = ui_data.buffer,
callback = function(_ev)
ui_data.cursor_start_moving = false
end,
})

vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = ui_data.buffer,
callback = function(ev)
Expand Down

0 comments on commit c4fc7e6

Please sign in to comment.