From 6b1f33a019ddd8b295c48e9522f6822f23b9fbe4 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 12 Mar 2026 01:50:05 +0000 Subject: [PATCH 01/18] add: nil_ls (nix lsp) --- nvim/lua/dzu/lsp/mason.lua | 1 + nvim/lua/dzu/lsp/nil_ls.lua | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 nvim/lua/dzu/lsp/nil_ls.lua diff --git a/nvim/lua/dzu/lsp/mason.lua b/nvim/lua/dzu/lsp/mason.lua index 69a9752..3047e81 100644 --- a/nvim/lua/dzu/lsp/mason.lua +++ b/nvim/lua/dzu/lsp/mason.lua @@ -23,6 +23,7 @@ local servers = { { nil, "jdtls" }, { "html", nil }, { "dockerls", nil }, + { "nil_ls", nil }, } local ensure_installed = {} local i = 1 diff --git a/nvim/lua/dzu/lsp/nil_ls.lua b/nvim/lua/dzu/lsp/nil_ls.lua new file mode 100644 index 0000000..be9e291 --- /dev/null +++ b/nvim/lua/dzu/lsp/nil_ls.lua @@ -0,0 +1,3 @@ +return { + filetypes = { "nix" }, +} From 1618c872f57db33b9fb3c660c34bd1df72e7cfef Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Sat, 21 Mar 2026 19:22:16 +0000 Subject: [PATCH 02/18] fix: r-a recursive panic fix --- nvim/lua/dzu/lsp/rust_analyzer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/dzu/lsp/rust_analyzer.lua b/nvim/lua/dzu/lsp/rust_analyzer.lua index 2d6a25f..a13c7db 100644 --- a/nvim/lua/dzu/lsp/rust_analyzer.lua +++ b/nvim/lua/dzu/lsp/rust_analyzer.lua @@ -19,7 +19,7 @@ return { enable = true -- show me bounds(?) }, termSearch = { - enable = true, -- nested completions? + enable = false, -- nested completions? }, }, hover = { From 513f66f3b3e3ea9f8f5355ba042ccfb901a1b2ac Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Sat, 21 Mar 2026 19:22:51 +0000 Subject: [PATCH 03/18] fix: no nil_ls, clangd, rust-analyzer autoinstall --- nvim/lua/dzu/lsp/mason.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nvim/lua/dzu/lsp/mason.lua b/nvim/lua/dzu/lsp/mason.lua index 3047e81..f1f5a9a 100644 --- a/nvim/lua/dzu/lsp/mason.lua +++ b/nvim/lua/dzu/lsp/mason.lua @@ -13,17 +13,16 @@ local settings = { require("mason").setup(settings) local servers = { - { "rust_analyzer", "rust_analyzer" }, + { nil, "rust_analyzer" }, { "pyright", "pyright" }, { "ts_ls", nil }, { "biome", nil }, - { "clangd", "clangd" }, - { "lua_ls", "lua_ls" }, + { "clangd", nil }, + { "lua_ls", nil }, { "tinymist", "tinymist" }, { nil, "jdtls" }, { "html", nil }, { "dockerls", nil }, - { "nil_ls", nil }, } local ensure_installed = {} local i = 1 From d8af800fc66a5264bc1a14e994c243257c60991b Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Sun, 29 Mar 2026 14:50:14 +0100 Subject: [PATCH 04/18] lsp: remove tinymist from autoinstalled lsps --- nvim/lua/dzu/lsp/mason.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/dzu/lsp/mason.lua b/nvim/lua/dzu/lsp/mason.lua index f1f5a9a..4aa9eb9 100644 --- a/nvim/lua/dzu/lsp/mason.lua +++ b/nvim/lua/dzu/lsp/mason.lua @@ -19,7 +19,7 @@ local servers = { { "biome", nil }, { "clangd", nil }, { "lua_ls", nil }, - { "tinymist", "tinymist" }, + { nil, "tinymist" }, { nil, "jdtls" }, { "html", nil }, { "dockerls", nil }, From 88963456dead877be1c5bcd32834358a46b7b7c5 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 14:25:43 +0100 Subject: [PATCH 05/18] rem: nvim-java --- nvim/lua/dzu/plugins/nvim-java.lua | 56 ------------------------------ 1 file changed, 56 deletions(-) delete mode 100644 nvim/lua/dzu/plugins/nvim-java.lua diff --git a/nvim/lua/dzu/plugins/nvim-java.lua b/nvim/lua/dzu/plugins/nvim-java.lua deleted file mode 100644 index 4231beb..0000000 --- a/nvim/lua/dzu/plugins/nvim-java.lua +++ /dev/null @@ -1,56 +0,0 @@ -return { - 'nvim-java/nvim-java', - config = function() - require('java').setup({ - -- Startup checks - checks = { - nvim_version = true, -- Check Neovim version - nvim_jdtls_conflict = true, -- Check for nvim-jdtls conflict - }, - - -- JDTLS configuration - jdtls = { - version = '1.54.0', - }, - - -- Extensions - lombok = { - enable = false, - version = '1.18.40', - }, - - java_test = { - enable = false, - version = '0.40.1', - }, - - java_debug_adapter = { - enable = false, - version = '0.58.2', - }, - - spring_boot_tools = { - enable = false, - version = '1.55.1', - }, - - -- JDK installation - jdk = { - auto_install = false, - version = '17', - }, - - -- Logging - log = { - use_console = false, - use_file = true, - level = 'info', - log_file = vim.fn.stdpath('state') .. '/nvim-java.log', - max_lines = 1000, - show_location = false, - }, - }) - -- vim.lsp.enable('jdtls') - end, - lazy = false, -} From 127efe1c624b110018c6808c4a89efd30f87e0ec Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 14:32:41 +0100 Subject: [PATCH 06/18] add: configure `nil_ls` (nix lsp) --- nvim/lua/dzu/lsp/mason.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/lua/dzu/lsp/mason.lua b/nvim/lua/dzu/lsp/mason.lua index 4aa9eb9..30421a5 100644 --- a/nvim/lua/dzu/lsp/mason.lua +++ b/nvim/lua/dzu/lsp/mason.lua @@ -23,6 +23,7 @@ local servers = { { nil, "jdtls" }, { "html", nil }, { "dockerls", nil }, + { nil, "nil_ls" }, } local ensure_installed = {} local i = 1 From 623b9609bc536768362ab8bc473801e36c607d49 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 15:43:39 +0100 Subject: [PATCH 07/18] fix: remove mason --- nvim/init.lua | 2 + nvim/lua/dzu/lsp.lua | 53 +++++++++++++++++ nvim/lua/dzu/lsp/biome.lua | 1 + nvim/lua/dzu/lsp/dockerls.lua | 1 + nvim/lua/dzu/lsp/init.lua | 19 ------ nvim/lua/dzu/lsp/mason.lua | 86 ---------------------------- nvim/lua/dzu/lsp/ts_ls.lua | 1 + nvim/lua/dzu/plugins/lsp.lua | 11 ---- nvim/lua/dzu/plugins/mason-tools.lua | 29 ---------- nvim/lua/dzu/plugins/mason.lua | 4 -- nvim/lua/dzu/plugins/nvim-cmp.lua | 1 + 11 files changed, 59 insertions(+), 149 deletions(-) create mode 100644 nvim/lua/dzu/lsp.lua create mode 100644 nvim/lua/dzu/lsp/biome.lua create mode 100644 nvim/lua/dzu/lsp/dockerls.lua delete mode 100644 nvim/lua/dzu/lsp/init.lua delete mode 100644 nvim/lua/dzu/lsp/mason.lua create mode 100644 nvim/lua/dzu/lsp/ts_ls.lua delete mode 100644 nvim/lua/dzu/plugins/lsp.lua delete mode 100644 nvim/lua/dzu/plugins/mason-tools.lua delete mode 100644 nvim/lua/dzu/plugins/mason.lua diff --git a/nvim/init.lua b/nvim/init.lua index b56f20c..a0c3b4d 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -8,3 +8,5 @@ require 'dzu.keymaps' require 'dzu.plugins' require 'dzu.snippets' + +require 'dzu.lsp' diff --git a/nvim/lua/dzu/lsp.lua b/nvim/lua/dzu/lsp.lua new file mode 100644 index 0000000..f685456 --- /dev/null +++ b/nvim/lua/dzu/lsp.lua @@ -0,0 +1,53 @@ +local servers = { + "rust_analyzer", + "pyright", + "ts_ls", + "biome", + "clangd", + "lua_ls", + "tinymist", + "jdtls", + "html", + "dockerls", + "nil_ls", +} + +local is_ok, handlers = pcall(require, "dzu.lsp.handlers") +if not is_ok then + vim.notify("failed to initialize LSP handlers") + return +end +handlers.setup() + +local opts = { + capabilities = handlers.capabilities, +} + +for _, server in pairs(servers) do + server = vim.split(server, "@")[1] + + local is_ok, conf_opts = pcall(require, "dzu.lsp." .. server) + if not is_ok then + vim.notify("Failed to initialize config for " .. server) + goto continue + end + local opts0 = vim.tbl_deep_extend("force", conf_opts, opts) + + vim.lsp.config(server, opts0) + vim.lsp.enable(server, true) + ::continue:: +end + +-- -- format code on save +-- vim.api.nvim_create_autocmd({ "BufWritePre" }, { +-- pattern = { +-- "*.rs", -- rust sources +-- "*.py", -- python sources +-- "*.js", -- javascript sources +-- "*.html", -- html files +-- }, +-- callback = function(ev) +-- vim.lsp.buf.format() +-- end, +-- }) + diff --git a/nvim/lua/dzu/lsp/biome.lua b/nvim/lua/dzu/lsp/biome.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/nvim/lua/dzu/lsp/biome.lua @@ -0,0 +1 @@ +return {} diff --git a/nvim/lua/dzu/lsp/dockerls.lua b/nvim/lua/dzu/lsp/dockerls.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/nvim/lua/dzu/lsp/dockerls.lua @@ -0,0 +1 @@ +return {} diff --git a/nvim/lua/dzu/lsp/init.lua b/nvim/lua/dzu/lsp/init.lua deleted file mode 100644 index 916aec8..0000000 --- a/nvim/lua/dzu/lsp/init.lua +++ /dev/null @@ -1,19 +0,0 @@ --- setup LSPs -local is_ok, _ = pcall(require, "dzu.lsp.mason") -if not is_ok then - vim.notify("failed to setup Mason") - return -end - --- -- format code on save --- vim.api.nvim_create_autocmd({ "BufWritePre" }, { --- pattern = { --- "*.rs", -- rust sources --- "*.py", -- python sources --- "*.js", -- javascript sources --- "*.html", -- html files --- }, --- callback = function(ev) --- vim.lsp.buf.format() --- end, --- }) diff --git a/nvim/lua/dzu/lsp/mason.lua b/nvim/lua/dzu/lsp/mason.lua deleted file mode 100644 index 30421a5..0000000 --- a/nvim/lua/dzu/lsp/mason.lua +++ /dev/null @@ -1,86 +0,0 @@ -local settings = { - ui = { - border = "none", - icons = { - package_installed = "◍", - package_pending = "◍", - package_uninstalled = "◍", - }, - }, - log_level = vim.log.levels.INFO, - max_concurrent_installers = 4, -} -require("mason").setup(settings) - -local servers = { - { nil, "rust_analyzer" }, - { "pyright", "pyright" }, - { "ts_ls", nil }, - { "biome", nil }, - { "clangd", nil }, - { "lua_ls", nil }, - { nil, "tinymist" }, - { nil, "jdtls" }, - { "html", nil }, - { "dockerls", nil }, - { nil, "nil_ls" }, -} -local ensure_installed = {} -local i = 1 -for _, s in pairs(servers) do - local s0 = s[1] - if s0 ~= nil then - table.insert(ensure_installed, i, s0) - i = i + 1 - vim.lsp.enable(s0, true) - end -end -for tool, _ in pairs(ADDITIONAL_MASON_TOOLS) do - table.insert(ensure_installed, i, tool) - i = i + 1 -end - -require("mason-tool-installer").setup({ - ensure_installed = ensure_installed, - auto_update = true, - run_on_start = true, -}) - -require("mason-lspconfig").setup({ - automatic_enable = true, - automatic_installation = true, -}) - -local config_servers = {} -for _, s in pairs(servers) do - local s1 = s[2] - if s1 ~= nil then - table.insert(config_servers, s1) - end -end - -local is_ok, handlers = pcall(require, "dzu.lsp.handlers") -if not is_ok then - vim.notify("failed to initialize LSP handlers") - return -end -handlers.setup() - -local opts = { - capabilities = handlers.capabilities, -} - -for _, server in pairs(config_servers) do - server = vim.split(server, "@")[1] - - local is_ok, conf_opts = pcall(require, "dzu.lsp." .. server) - if not is_ok then - vim.notify("Failed to initialize config for " .. server) - goto continue - end - local opts0 = vim.tbl_deep_extend("force", conf_opts, opts) - - vim.lsp.config(server, opts0) - vim.lsp.enable(server, true) - ::continue:: -end diff --git a/nvim/lua/dzu/lsp/ts_ls.lua b/nvim/lua/dzu/lsp/ts_ls.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/nvim/lua/dzu/lsp/ts_ls.lua @@ -0,0 +1 @@ +return {} diff --git a/nvim/lua/dzu/plugins/lsp.lua b/nvim/lua/dzu/plugins/lsp.lua deleted file mode 100644 index a6c64f7..0000000 --- a/nvim/lua/dzu/plugins/lsp.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - "mason-org/mason-lspconfig.nvim", - dependencies = { - "mason-org/mason.nvim", - "neovim/nvim-lspconfig", - -- lsp completions - "hrsh7th/cmp-nvim-lsp", - 'nvim-java/nvim-java', - }, - lazy = false, -} diff --git a/nvim/lua/dzu/plugins/mason-tools.lua b/nvim/lua/dzu/plugins/mason-tools.lua deleted file mode 100644 index cced0fc..0000000 --- a/nvim/lua/dzu/plugins/mason-tools.lua +++ /dev/null @@ -1,29 +0,0 @@ -local function config() - local is_ok, _ = pcall(require, "mason-tool-installer") - if not is_ok then - vim.notify("Failed to setup mason tools") - return - end - - local is_ok, _ = pcall(require, "dzu.lsp") - if not is_ok then - vim.notify("failed to setup lsp") - return - end -end - -return { - "WhoIsSethDaniel/mason-tool-installer.nvim", - dependencies = { - "mason-org/mason-lspconfig.nvim", - }, - config = config, - lazy = false, - opts = { - integrations = { - ["mason-lspconfig"] = true, - ["mason-null-ls"] = false, - ["mason-nvim-dap"] = false, - }, - }, -} diff --git a/nvim/lua/dzu/plugins/mason.lua b/nvim/lua/dzu/plugins/mason.lua deleted file mode 100644 index 08a7e84..0000000 --- a/nvim/lua/dzu/plugins/mason.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - "mason-org/mason.nvim", - opts = {} -} diff --git a/nvim/lua/dzu/plugins/nvim-cmp.lua b/nvim/lua/dzu/plugins/nvim-cmp.lua index d902967..844958a 100644 --- a/nvim/lua/dzu/plugins/nvim-cmp.lua +++ b/nvim/lua/dzu/plugins/nvim-cmp.lua @@ -203,6 +203,7 @@ end return { "hrsh7th/nvim-cmp", dependencies = { + "cmp-nvim-lsp", "saadparwaiz1/cmp_luasnip", { "L3MON4D3/LuaSnip", From 416e2b4347ad3867e341f4c3f66b33313c65afd9 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 15:43:59 +0100 Subject: [PATCH 08/18] fix(lsp): lua-ls config --- nvim/lua/dzu/lsp/lua_ls.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/lua/dzu/lsp/lua_ls.lua b/nvim/lua/dzu/lsp/lua_ls.lua index a67daa5..7063c53 100644 --- a/nvim/lua/dzu/lsp/lua_ls.lua +++ b/nvim/lua/dzu/lsp/lua_ls.lua @@ -1,4 +1,7 @@ return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' }, settings = { Lua = { runtime = { From 057528c0bf2824aa601ff1dd02def92927c09241 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 15:44:09 +0100 Subject: [PATCH 09/18] fix(lsp): nil-ls (nix) config --- nvim/lua/dzu/lsp/nil_ls.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/lua/dzu/lsp/nil_ls.lua b/nvim/lua/dzu/lsp/nil_ls.lua index be9e291..8e0c904 100644 --- a/nvim/lua/dzu/lsp/nil_ls.lua +++ b/nvim/lua/dzu/lsp/nil_ls.lua @@ -1,3 +1,5 @@ return { + cmd = { "nil" }, + root_markers = { { "flake.nix", "flake.lock" }, ".git" }, filetypes = { "nix" }, } From c7da0740af47bc10bcb0f82b5d6e1a5c499d03ab Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 15:59:59 +0100 Subject: [PATCH 10/18] fix: fix jdtls config - use envvar-provided paths for jdk config - specify filetypes - ask to not validate java, because OMG please no - use CLASSPATH to derive referenced libraries --- nvim/lua/dzu/lsp/jdtls.lua | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/nvim/lua/dzu/lsp/jdtls.lua b/nvim/lua/dzu/lsp/jdtls.lua index 26cf4c3..a3eeb6a 100644 --- a/nvim/lua/dzu/lsp/jdtls.lua +++ b/nvim/lua/dzu/lsp/jdtls.lua @@ -1,19 +1,41 @@ +local jdk_name = os.getenv("JDTLS_JDK_NAME") +local jdk_path = os.getenv("JDTLS_JDK_PATH") +local classpath = os.getenv("CLASSPATH") or "" +local jdtls_libs = {} + +for path in string.gmatch(classpath, "[^:]+") do + if string.len(path) == 0 then + -- empty path, nothing to do + goto continue + end + + if string.sub(path, -4) ~= ".jar" then + -- not a jar in path, skip + goto continue + end + + table.insert(jdtls_libs, path) + + ::continue:: +end + return { + cmd = { "jdtls", "--java-no-verify" }, + filetypes = { "java" }, + root_markers = { ".git", "build.xml" }, settings = { java = { configuration = { runtimes = { { - name = "openjdk 21.0.9", - path = "/usr/lib/jvm/java-21-openjdk/", + name = jdk_name, + path = jdk_path, default = true, } } }, project = { - referencedLibraries = { - './lib/*.jar', - }, + referencedLibraries = jdtls_libs, } } }, @@ -43,5 +65,4 @@ return { } }, init_options = {}, - root_markers = { "build.xml" }, } From bf712c11874f613c56267a18f7628f6639b44ddb Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 16:57:13 +0100 Subject: [PATCH 11/18] fix(TS): switch to `main` branch --- nvim/lua/dzu/plugins/tree-sitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/dzu/plugins/tree-sitter.lua b/nvim/lua/dzu/plugins/tree-sitter.lua index 4be5159..3c4db1c 100644 --- a/nvim/lua/dzu/plugins/tree-sitter.lua +++ b/nvim/lua/dzu/plugins/tree-sitter.lua @@ -2,7 +2,7 @@ return { "nvim-treesitter/nvim-treesitter", - branch = "master", + branch = "main", build = ':TSUpdate', lazy = false, } From 4ce1251569e48313214353b21eac65fe617e14f8 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 17:19:21 +0100 Subject: [PATCH 12/18] fix(TS): update syntax to 0.12 rewrite --- nvim/lua/dzu/syntax.lua | 93 +++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 55 deletions(-) diff --git a/nvim/lua/dzu/syntax.lua b/nvim/lua/dzu/syntax.lua index 0a9eefc..9508c6f 100644 --- a/nvim/lua/dzu/syntax.lua +++ b/nvim/lua/dzu/syntax.lua @@ -1,89 +1,72 @@ local M = {} function M.setup() - local is_ok, tree_sitter_config = pcall(require, "nvim-treesitter.configs") + local is_ok, tree_sitter = pcall(require, "nvim-treesitter") if not is_ok then vim.notify("couldn't find tree sitter") return end - local cfg = { + tree_sitter.setup() + + local is_ok, tree_sitter_config = pcall(require, "nvim-treesitter.config") + if not is_ok then + vim.notify("couldn't find tree sitter config") + return + end + + local ensure_installed = { "bash", "c", - { "comment", nil }, + "comment", "csv", - { "dockerfile", nil }, + "dockerfile", "fish", - { "gitignore", "gitignore" }, - { "haskell", "hs" }, + "gitignore", + "haskell", "html", - { "javascript", "js" }, - { "typescript", "ts" }, + "javascript", + "typescript", "tsx", "json", "lua", - { "luadoc", nil }, - { "make", nil }, - { "markdown", "md" }, - { "markdown_inline", "md" }, - { "python", "py" }, - { "rust", "rs" }, + "luadoc", + "make", + "markdown", + "markdown_inline", + "python", + "rust", "sql", "toml", - { "vim", nil }, - { "vimdoc", nil }, + "vim", + "vimdoc", "xml", "nu", "java", "yaml", } - local langs = {} - local li = 1 - local pattern = {} - local pi = 1 - for _, spec in pairs(cfg) do - if type(spec) == "table" then - table.insert(langs, li, spec[1]) - li = li + 1 - if type(spec[2]) ~= "nil" then - table.insert(pattern, pi, "*." .. spec[2]) - pi = pi + 1 - end - else - table.insert(langs, li, spec) - li = li + 1 - table.insert(pattern, pi, "*." .. spec) - pi = pi + 1 - end - end - table.insert(pattern, pi, "Dockerfile*") - pi = pi + 1 - table.insert(pattern, pi, "Cargo.lock") - pi = pi + 1 - table.insert(pattern, pi, "makefile*") - pi = pi + 1 - table.insert(pattern, pi, "Makefile*") - pi = pi + 1 + -- src: https://www.qu8n.com/posts/treesitter-migration-guide-for-nvim-0-12 + local already_installed = require('nvim-treesitter.config').get_installed() + local install = vim.iter(ensure_installed) + :filter(function(parser) + return not vim.tbl_contains(already_installed, parser) + end) + :totable() + tree_sitter.install(install) - local opts = { - ensure_installed = langs, - highlight = { - enable = true, -- false will disable the whole extension - }, - } - tree_sitter_config.setup(opts) + vim.treesitter.language.register("xml", "ant") vim.cmd.TSUpdate() - vim.api.nvim_create_autocmd('BufWinEnter', { - pattern = pattern, + vim.api.nvim_create_autocmd('FileType', { callback = function() - vim.treesitter.start() + -- Enable treesitter highlighting and disable regex syntax + pcall(vim.treesitter.start) + -- Enable treesitter-based indentation + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end, }) - - vim.treesitter.language.register("xml", "ant") end return M From 467ada093245ded6ce0c757146da90d7d11675a5 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 17:24:15 +0100 Subject: [PATCH 13/18] fix(LSP): rust-analyzer config --- nvim/lua/dzu/lsp/rust_analyzer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/lua/dzu/lsp/rust_analyzer.lua b/nvim/lua/dzu/lsp/rust_analyzer.lua index a13c7db..2aa4cfb 100644 --- a/nvim/lua/dzu/lsp/rust_analyzer.lua +++ b/nvim/lua/dzu/lsp/rust_analyzer.lua @@ -1,4 +1,7 @@ return { + cmd = { "rust-analyzer" }, + filetypes = { "rust" }, + root_markers = { ".git", "Cargo.lock" }, settings = { ['rust-analyzer'] = { diagnostics = { From 63d77e77e0639b540d0503e94cda6155542faa30 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 9 Apr 2026 17:30:25 +0100 Subject: [PATCH 14/18] ench: disable folding --- nvim/lua/dzu/options.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/lua/dzu/options.lua b/nvim/lua/dzu/options.lua index dff4314..8d40466 100644 --- a/nvim/lua/dzu/options.lua +++ b/nvim/lua/dzu/options.lua @@ -58,6 +58,9 @@ local options = { -- clipboard clipboard = 'unnamedplus', + + -- no folding + foldenable = false, } for k, v in pairs(options) do From bda43148f0bd32192762f004383c482eb1ddafd6 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Fri, 10 Apr 2026 16:28:44 +0100 Subject: [PATCH 15/18] add: Arduino support (syntax+LSP) --- nvim/lua/dzu/lsp.lua | 6 +++--- nvim/lua/dzu/lsp/arduino-language-server.lua | 18 ++++++++++++++++++ nvim/lua/dzu/syntax.lua | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 nvim/lua/dzu/lsp/arduino-language-server.lua diff --git a/nvim/lua/dzu/lsp.lua b/nvim/lua/dzu/lsp.lua index f685456..c14dab5 100644 --- a/nvim/lua/dzu/lsp.lua +++ b/nvim/lua/dzu/lsp.lua @@ -4,12 +4,13 @@ local servers = { "ts_ls", "biome", "clangd", - "lua_ls", + "lua_ls", "tinymist", "jdtls", "html", "dockerls", "nil_ls", + "arduino-language-server", } local is_ok, handlers = pcall(require, "dzu.lsp.handlers") @@ -31,7 +32,7 @@ for _, server in pairs(servers) do vim.notify("Failed to initialize config for " .. server) goto continue end - local opts0 = vim.tbl_deep_extend("force", conf_opts, opts) + local opts0 = vim.tbl_deep_extend("force", opts, conf_opts) vim.lsp.config(server, opts0) vim.lsp.enable(server, true) @@ -50,4 +51,3 @@ end -- vim.lsp.buf.format() -- end, -- }) - diff --git a/nvim/lua/dzu/lsp/arduino-language-server.lua b/nvim/lua/dzu/lsp/arduino-language-server.lua new file mode 100644 index 0000000..5d59719 --- /dev/null +++ b/nvim/lua/dzu/lsp/arduino-language-server.lua @@ -0,0 +1,18 @@ +-- local port = os.getenv("ARDUINO_PORT") +local fcbn = os.getenv("ARDUINO_FCBN") + +return { + filetypes = { "arduino" }, + root_markers = { ".git", "sketch.yaml" }, + cmd = { + "arduino-language-server", + "-jobs", "0", + "-fqbn", fcbn, + "-no-real-time-diagnostics", + "-skip-libraries-discovery-on-rebuild", + }, + capabilities = { + textDocument = { semanticTokens = vim.NIL }, + workspace = { semanticTokens = vim.NIL }, + }, +} diff --git a/nvim/lua/dzu/syntax.lua b/nvim/lua/dzu/syntax.lua index 9508c6f..66fd7fd 100644 --- a/nvim/lua/dzu/syntax.lua +++ b/nvim/lua/dzu/syntax.lua @@ -44,6 +44,7 @@ function M.setup() "nu", "java", "yaml", + "arduino", } -- src: https://www.qu8n.com/posts/treesitter-migration-guide-for-nvim-0-12 From 88a3b7f8f2a1625c2471d6e967c194b7427154db Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Sat, 11 Apr 2026 10:17:58 +0100 Subject: [PATCH 16/18] fix: give up on arduino lsp, it's horrible. --- nvim/lua/dzu/lsp.lua | 1 - nvim/lua/dzu/lsp/arduino-language-server.lua | 18 ------------------ nvim/lua/dzu/lsp/clangd.lua | 4 ++-- 3 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 nvim/lua/dzu/lsp/arduino-language-server.lua diff --git a/nvim/lua/dzu/lsp.lua b/nvim/lua/dzu/lsp.lua index c14dab5..b9491a4 100644 --- a/nvim/lua/dzu/lsp.lua +++ b/nvim/lua/dzu/lsp.lua @@ -10,7 +10,6 @@ local servers = { "html", "dockerls", "nil_ls", - "arduino-language-server", } local is_ok, handlers = pcall(require, "dzu.lsp.handlers") diff --git a/nvim/lua/dzu/lsp/arduino-language-server.lua b/nvim/lua/dzu/lsp/arduino-language-server.lua deleted file mode 100644 index 5d59719..0000000 --- a/nvim/lua/dzu/lsp/arduino-language-server.lua +++ /dev/null @@ -1,18 +0,0 @@ --- local port = os.getenv("ARDUINO_PORT") -local fcbn = os.getenv("ARDUINO_FCBN") - -return { - filetypes = { "arduino" }, - root_markers = { ".git", "sketch.yaml" }, - cmd = { - "arduino-language-server", - "-jobs", "0", - "-fqbn", fcbn, - "-no-real-time-diagnostics", - "-skip-libraries-discovery-on-rebuild", - }, - capabilities = { - textDocument = { semanticTokens = vim.NIL }, - workspace = { semanticTokens = vim.NIL }, - }, -} diff --git a/nvim/lua/dzu/lsp/clangd.lua b/nvim/lua/dzu/lsp/clangd.lua index bd86e02..ab99bfd 100644 --- a/nvim/lua/dzu/lsp/clangd.lua +++ b/nvim/lua/dzu/lsp/clangd.lua @@ -1,6 +1,6 @@ return { - filetypes = { "c", "h", "cpp" }, - single_file_support = true, + filetypes = { "c", "h", "cpp", "arduino" }, + root_markers = { ".git", "sketch.yaml" }, cmd = { "clangd", -- "-Wall", From d11f861e6ac06c7f18693dcf26aeaa224dfe0091 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Fri, 1 Jan 2016 00:12:59 +0000 Subject: [PATCH 17/18] fix(lsp): tweak settings for pyright --- nvim/lua/dzu/lsp/pyright.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/lua/dzu/lsp/pyright.lua b/nvim/lua/dzu/lsp/pyright.lua index 7b93938..e8ed571 100644 --- a/nvim/lua/dzu/lsp/pyright.lua +++ b/nvim/lua/dzu/lsp/pyright.lua @@ -1,4 +1,7 @@ return { + cmd = { "pyright-langserver", "--stdio" }, + filetypes = { "python" }, + root_markers = { ".git" }, settings = { pyright = { disableLanguageServices = false, From 532d0c18f0a19a507baa72a3cb97f61c9976d373 Mon Sep 17 00:00:00 2001 From: Dzuchun Date: Thu, 16 Apr 2026 13:00:20 +0100 Subject: [PATCH 18/18] fix(lsp): tinymist lsp config --- nvim/lua/dzu/lsp/tinymist.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/lua/dzu/lsp/tinymist.lua b/nvim/lua/dzu/lsp/tinymist.lua index f6e4345..d46e3bc 100644 --- a/nvim/lua/dzu/lsp/tinymist.lua +++ b/nvim/lua/dzu/lsp/tinymist.lua @@ -10,6 +10,9 @@ vim.api.nvim_create_user_command("OpenPdf", function() end, {}) return { + cmd = { "tinymist" }, + filetypes = { "typst" }, + root_markers = { ".git", "main.typ" }, settings = { formatterMode = "typstyle", exportPdf = "onType",