Skip to content

Commit

Permalink
feat: tangle_on_write option
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas committed Jul 9, 2024
1 parent c5844ca commit 2fc64ba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lua/neorg/modules/core/tangle/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ module.load = function()
},
})
end)

if module.config.public.tangle_on_write then
local augroup = vim.api.nvim_create_augroup("norg_auto_tangle", { clear = true })
vim.api.nvim_create_autocmd("BufWritePost", {
desc = "Tangle the current file on write",
pattern = "*.norg",
group = augroup,
command = "Neorg tangle current-file",
})
end
end

local function get_comment_string(language)
Expand Down Expand Up @@ -421,6 +431,9 @@ module.public = {
module.config.public = {
-- Notify when there is nothing to tangle (INFO) or when the content is empty (WARN).
report_on_empty = true,

-- Tangle all code blocks in the current norg file on file write.
tangle_on_write = false,
}

module.on_event = function(event)
Expand Down

0 comments on commit 2fc64ba

Please sign in to comment.