neovim-dotfiles/lua/plugins/neorg.lua
2026-08-21 17:12:45 +02:00

69 lines
2.1 KiB
Lua

---@module "utils.plugins"
---@type Plugin
return {
after = { "telescope", "nvim-treesitter" },
configure = function(load)
load("nvim-neotest/nvim-nio")
load("pysan3/pathlib.nvim")
load("nvim-neorg/lua-utils.nvim")
load("nvim-neorg/tree-sitter-norg")
-- parser {{{
local data = vim.fn.stdpath("data")
local src = data .. "/site/pack/core/opt/tree-sitter-norg"
local src_meta = data .. "/site/pack/core/opt/tree-sitter-norg-meta"
local parser_dir = data .. "/site/parser"
vim.fn.mkdir(parser_dir, "p")
local out = parser_dir .. "/norg.so"
local out_meta = parser_dir .. "/norg_meta.so"
if not vim.uv.fs_stat(out) and vim.uv.fs_stat(src) then
-- not already built, and src present
local result = vim.system({ "nix", "build" }, { cwd = src }):wait()
if result.code == 0 then
vim.system({ "cp", "result/lib/lua/5.1/parser/norg.so", out }, { cwd = src }):wait()
else
vim.notify("failed to run nix build for norg treesitter, got result " .. tostring(result),
vim.log.levels.ERROR)
end
end
if not vim.uv.fs_stat(out_meta) and vim.uv.fs_stat(src_meta) then
-- not already built, and src present
local result = vim.system({ "nix", "build" }, { cwd = src_meta }):wait()
if result.code == 0 then
vim.system({ "cp", "result/parser", out_meta }, { cwd = src_meta }):wait()
else
vim.notify("failed to run nix build for norg_meta treesitter, got result " .. tostring(result),
vim.log.levels.ERROR)
end
end
-- }}}
load("nvim-neorg/neorg")
require("neorg").setup({
load = {
["core.defaults"] = {},
["core.concealer"] = {},
-- ["core.completion"] = { config = { engine = "nvim-cmp" } },
["core.integrations.treesitter"] = {
config = { configure_parsers = false },
},
["core.clipboard.code-blocks"] = {},
["core.esupports.indent"] = {},
["core.dirman"] = {
config = {
workspaces = {
school = "~/Documents/school",
notes = "~/Documents/notes",
uni = "~/Documents/uni",
},
default_workspace = "notes",
},
},
},
})
require("nvim-treesitter").install({ "norg", "norg_meta" }):wait(300000)
end,
}