Skip to content

Commit

Permalink
fix(toc): listen cursormoved for all norg files
Browse files Browse the repository at this point in the history
  • Loading branch information
champignoom committed Nov 29, 2023
1 parent 9f0683f commit 71291ef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/neorg/modules/core/qol/toc/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,16 @@ module.on_event = function(event)

if module.config.public.sync_cursorline then
vim.api.nvim_create_autocmd({"CursorMoved", "CursorMovedI"}, {
buffer = previous_buffer,
pattern = "*.norg",
callback = function(ev)
assert(ev.buf == previous_buffer)
if not vim.api.nvim_buf_is_valid(buffer) or not vim.api.nvim_buf_is_loaded(buffer) then
return true
end

if ev.buf ~= previous_buffer then
return
end

module.public.update_cursor(ev.buf, vim.fn.bufwinid(ev.buf), buffer, window)
end,
})
Expand Down

0 comments on commit 71291ef

Please sign in to comment.