diff --git a/dots/.config/nvim/after/ftplugin/org.lua b/dots/.config/nvim/after/ftplugin/org.lua index e3cd2a4a..d088657f 100644 --- a/dots/.config/nvim/after/ftplugin/org.lua +++ b/dots/.config/nvim/after/ftplugin/org.lua @@ -2,3 +2,11 @@ vim.opt_local.shiftwidth = 2 vim.opt_local.modeline = true vim.opt_local.wrap = false vim.opt_local.conceallevel = 1 +-- HACK: Correctly handle treesitter attachment. Without this folds and reformatting fall out of +-- sync and treesitter can fail to properly parse the buffer on content modifications. +if not vim.b.org_did_edit then + vim.b.org_did_edit = true + vim.defer_fn(vim.schedule_wrap(function() + vim.cmd.edit() + end), 10) +end diff --git a/dots/.config/nvim/lua/plugins/configs/org-mode.lua b/dots/.config/nvim/lua/plugins/configs/org-mode.lua index dddf76b8..dcf080af 100644 --- a/dots/.config/nvim/lua/plugins/configs/org-mode.lua +++ b/dots/.config/nvim/lua/plugins/configs/org-mode.lua @@ -66,9 +66,6 @@ return { vim.api.nvim_set_hl(0, "org_bold_delimiter", { link = "@punctuation.delimiter" }) vim.api.nvim_set_hl(0, "org_underline_delimiter", { link = "@punctuation.delimiter" }) vim.api.nvim_set_hl(0, "org_strikethrough_delimiter", { link = "@punctuation.delimiter" }) - if vim.bo.filetype == "org" then - vim.cmd.doautocmd("FileType org") - end end, }, }