Skip to content

Commit

Permalink
feat(toc): add close_after_use configuration option (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Apr 19, 2023
1 parent 1fecaab commit e5d7fbb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lua/neorg/modules/core/norg/qol/toc/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ module.load = function()
end)
end

module.config.public = {
-- If `true`, will close the Table of Contents after an entry in the table
-- is picked.
close_after_use = false,
}

module.public = {
parse_toc_macro = function(buffer)
local toc, toc_name = false, nil
Expand Down Expand Up @@ -205,6 +211,11 @@ module.public = {
vim.api.nvim_set_current_win(original_window)
vim.api.nvim_set_current_buf(original_buffer)
vim.api.nvim_win_set_cursor(original_window, { location[1] + 1, location[2] })

if module.config.public.close_after_use then

vim.api.nvim_buf_delete(ui_buffer, { force = true })
end
end,
})
end,
Expand Down

0 comments on commit e5d7fbb

Please sign in to comment.