diff --git a/init.lua b/init.lua index 1d18b23..3ed62a3 100644 --- a/init.lua +++ b/init.lua @@ -13,7 +13,7 @@ local plugins = { "treesitter", "nvim-lint", - -- "neorg", + "neorg", "nightfox", diff --git a/lua/plugins/blink-cmp.lua b/lua/plugins/blink-cmp.lua index ebe1919..dcee929 100644 --- a/lua/plugins/blink-cmp.lua +++ b/lua/plugins/blink-cmp.lua @@ -7,8 +7,10 @@ return { require("lazydev").setup({}) load("rafamadriz/friendly-snippets") + load("saghen/blink.lib") load("saghen/blink.cmp") + ---@module "blink.cmp" require("blink.cmp").setup({ keymap = { preset = "super-tab" }, @@ -47,22 +49,7 @@ return { end, onUpdate = function() vim.notify("Building blink.cmp", vim.log.levels.INFO) - local cmd - if vim.fn.executable("nix") == 1 then - cmd = { "nix", "run", ".#build-plugin" } - elseif vim.fn.executable("cargo") == 1 then - cmd = { "cargo", "build", "--release" } - else - print("either cargo or nix is needed to build blink.cmp fzf") - return - end - local obj = vim.system(cmd, { cwd = vim.pack.get({ "blink.cmp" })[1].path }) - :wait() - if obj.code == 0 then - vim.notify("Building blink.cmp done", vim.log.levels.INFO) - else - vim.notify("Building blink.cmp failed", vim.log.levels.ERROR) - end + require('blink.cmp').build():pwait() end, } diff --git a/lua/plugins/neorg.lua b/lua/plugins/neorg.lua index f84e0d3..9294fcc 100644 --- a/lua/plugins/neorg.lua +++ b/lua/plugins/neorg.lua @@ -6,20 +6,50 @@ return { load("nvim-neotest/nvim-nio") load("pysan3/pathlib.nvim") load("nvim-neorg/lua-utils.nvim") - load("juniorsundar/neorg-extras") + 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 = { - ["external.many-mans"] = { - config = { - metadata_fold = true, -- If want @data property ... @end to fold - code_fold = true, -- If want @code ... @end to fold - }, - }, ["core.defaults"] = {}, ["core.concealer"] = {}, -- ["core.completion"] = { config = { engine = "nvim-cmp" } }, - -- ["core.integrations.treesitter"] = {}, + ["core.integrations.treesitter"] = { + config = { configure_parsers = false }, + }, ["core.clipboard.code-blocks"] = {}, ["core.esupports.indent"] = {}, ["core.dirman"] = { diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua index 4d95fd4..66ddb1f 100644 --- a/lua/plugins/nvim-lint.lua +++ b/lua/plugins/nvim-lint.lua @@ -16,6 +16,7 @@ return { underline = true, update_in_insert = false, virtual_text = true, + virtual_lines = { current_line = true }, }) require("lint").linters_by_ft = require("mason-bridge").get_linters()