diff --git a/.gitignore b/.gitignore index 20414eb..b901caf 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ sublime-text/Local/* /sublime-text/Trash/* nvim/autoload/plug.vim.old nvim/.luarc.json +.claude +CLAUDE* diff --git a/desktop/nvim/lazy-lock.json b/desktop/nvim/lazy-lock.json index a55f0f8..2b9f290 100644 --- a/desktop/nvim/lazy-lock.json +++ b/desktop/nvim/lazy-lock.json @@ -1,5 +1,5 @@ { - "LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" }, + "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" }, "barbar.nvim": { "branch": "master", "commit": "a4bef5b4fc1f064f2f673172252028eae18191c9" }, "buffer-vacuum": { "branch": "main", "commit": "917986d31cce6501c929ab6088c0887beff56b69" }, "catppuccin": { "branch": "main", "commit": "426dbebe06b5c69fd846ceb17b42e12f890aedf1" }, @@ -9,28 +9,29 @@ "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "go-tagger.nvim": { "branch": "master", "commit": "8fb11cdda459d2336c6312d9dfb2108f250b95e2" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "local-highlight.nvim": { "branch": "master", "commit": "dd8ae2ca26a5cfa17fb598864eacbe2df63938f3" }, "lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason.nvim": { "branch": "main", "commit": "cb8445f8ce85d957416c106b780efd51c6298f89" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "84c75e7a7e443586f60508d12fc50f90d9aee14e" }, - "none-ls-extras.nvim": { "branch": "main", "commit": "70ec8815cdf186223af04cc5a15bc8bdface0ef0" }, - "none-ls.nvim": { "branch": "main", "commit": "241ff8214b4ec051eb51e74a61ff729c0271b429" }, + "mason.nvim": { "branch": "main", "commit": "bb639d4bf385a4d89f478b83af4d770be05ab7eb" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "ebd66767191714e008ce73b769518a763ff31bdc" }, + "none-ls-extras.nvim": { "branch": "main", "commit": "167f29529ff1438e673b1792a71aaf79ddd6c74f" }, + "none-ls.nvim": { "branch": "main", "commit": "f9d557ac7cd28a3a993b5ea49716498bd540b01f" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, "nvim-colorizer.lua": { "branch": "master", "commit": "5cfe7fffbd01e17b3c1e14af85d5febdef88bd8c" }, - "nvim-lspconfig": { "branch": "master", "commit": "31026a13eefb20681124706a79fc1df6bf11ab27" }, - "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, + "nvim-lspconfig": { "branch": "master", "commit": "a4ed4e761c400849e8c9f8bda33e5083f890268c" }, + "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e" }, "nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" }, - "nvim-web-devicons": { "branch": "master", "commit": "4fc505ac7bd7692824a142e96e5f529c133862f8" }, + "nvim-web-devicons": { "branch": "master", "commit": "0d7d35fa946837b8738b17c18d1faa1ac351e7f9" }, "oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "08783ec022e7ddefe0f12a16f1ac4968f55478b0" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "a798325b7f36acc62741d1029930a7b96d4dd4bf" }, "ruffer": { "branch": "plugin", "commit": "5248604605bf1039147f3f29dcd46aa296557e9c" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, @@ -40,7 +41,7 @@ "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, "vim-dadbod-ui": { "branch": "master", "commit": "07e92e22114cc5b1ba4938d99897d85b58e20475" }, "vim-devicons": { "branch": "master", "commit": "71f239af28b7214eebb60d4ea5bd040291fb7e33" }, - "vim-floaterm": { "branch": "master", "commit": "0ab5eb8135dc884bc543a819ac7033c15e72a76b" }, + "vim-floaterm": { "branch": "master", "commit": "bb4ba7952e906408e1f83b215f55ffe57efcade6" }, "vim-signature": { "branch": "master", "commit": "6bc3dd1294a22e897f0dcf8dd72b85f350e306bc" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" } } diff --git a/desktop/nvim/lua/lspConfig.lua b/desktop/nvim/lua/lspConfig.lua index 0de3b46..fcaab5f 100644 --- a/desktop/nvim/lua/lspConfig.lua +++ b/desktop/nvim/lua/lspConfig.lua @@ -181,7 +181,7 @@ null_ls.setup({ ruff_format, }, on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then -- run formatters on save + if client:supports_method("textDocument/formatting") then -- run formatters on save vim.api.nvim_create_autocmd("BufWritePre", { buffer = bufnr, callback = function() @@ -193,49 +193,39 @@ null_ls.setup({ }) --"'''''''''''''''''''Tree sitter highlight'''''''''''''''''''''''''''''' -require("nvim-treesitter.configs").setup({ - -- A list of parser names, or "all" - ensure_installed = { "lua", "bash", "python", "typescript", "javascript", "go" }, - sync_install = false, - indent = { - enable = true, - disable = function(lang, bufnr) - local enabled_langs = { "html", "javascript", "tsx", "go" } -- Enable auto indent only for these languages - return not vim.tbl_contains(enabled_langs, lang) - end, - }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@class.outer", - ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, - ["as"] = { query = "@local.scope", query_group = "locals", desc = "Select language scope" }, - }, - selection_modes = { - ["@parameter.outer"] = "v", -- charwise - ["@function.outer"] = "V", -- linewise - ["@class.outer"] = "", -- blockwise - }, - include_surrounding_whitespace = false, - }, - move = { - enable = true, - set_jumps = true, - goto_next_start = { - [""] = "@function.outer", -- jump to next function - }, - goto_previous_start = { - [""] = "@function.outer", -- jump to previous function - }, - }, - }, +require("nvim-treesitter").install({ "lua", "bash", "python", "typescript", "javascript", "go" }) + +local ts_indent_langs = { "html", "javascript", "tsx", "go", "lua" } +vim.api.nvim_create_autocmd("FileType", { + callback = function(ev) + pcall(vim.treesitter.start) + if vim.tbl_contains(ts_indent_langs, ev.match) then + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end + end, }) + +require("nvim-treesitter-textobjects").setup({ + select = { + lookahead = true, + selection_modes = { + ["@parameter.outer"] = "v", + ["@function.outer"] = "V", + ["@class.outer"] = "", + }, + include_surrounding_whitespace = false, + }, + move = { set_jumps = true }, +}) + +local select = require("nvim-treesitter-textobjects.select") +local move = require("nvim-treesitter-textobjects.move") + +vim.keymap.set({ "x", "o" }, "af", function() select.select_textobject("@function.outer", "textobjects") end) +vim.keymap.set({ "x", "o" }, "if", function() select.select_textobject("@function.inner", "textobjects") end) +vim.keymap.set({ "x", "o" }, "ac", function() select.select_textobject("@class.outer", "textobjects") end) +vim.keymap.set({ "x", "o" }, "ic", function() select.select_textobject("@class.inner", "textobjects") end) +vim.keymap.set({ "x", "o" }, "as", function() select.select_textobject("@local.scope", "locals") end) + +vim.keymap.set({ "n", "x", "o" }, "", function() move.goto_next_start("@function.outer", "textobjects") end) +vim.keymap.set({ "n", "x", "o" }, "", function() move.goto_previous_start("@function.outer", "textobjects") end) diff --git a/desktop/nvim/lua/plugins.lua b/desktop/nvim/lua/plugins.lua index 5f3af02..9c0e254 100644 --- a/desktop/nvim/lua/plugins.lua +++ b/desktop/nvim/lua/plugins.lua @@ -68,9 +68,11 @@ local plugins = { -- Treesitter { "nvim-treesitter/nvim-treesitter", + branch = "main", + lazy = false, build = ":TSUpdate", }, - { "nvim-treesitter/nvim-treesitter-textobjects" }, + { "nvim-treesitter/nvim-treesitter-textobjects", branch = "main" }, -- Mason package manager { @@ -102,9 +104,12 @@ local plugins = { { "tpope/vim-surround" }, -- Formatter/Linter integration - { "nvimtools/none-ls.nvim", dependencies = { - "nvimtools/none-ls-extras.nvim", - } }, + { + "nvimtools/none-ls.nvim", + dependencies = { + "nvimtools/none-ls-extras.nvim", + }, + }, -- Treesitter auto-closing tags { "windwp/nvim-ts-autotag" }, @@ -195,6 +200,25 @@ local plugins = { vim.g.db_ui_use_nerd_fonts = 1 end, }, + + -- go-tagger + { + "romus204/go-tagger.nvim", + config = function() + require("go-tagger").setup({ + skip_private = true, + casing = "camelCase", + tags = { + json = { + casing = "camelCase", + }, + xml = { + casing = "snake_case", + }, + }, + }) + end, + }, } local opts = {} diff --git a/desktop/nvim/patches/README.md b/desktop/nvim/patches/README.md new file mode 100644 index 0000000..78919b0 --- /dev/null +++ b/desktop/nvim/patches/README.md @@ -0,0 +1,38 @@ +# Patches + +Local fixes for archived or unmaintained plugins that won't receive upstream updates. + +--- + +## nvim-treesitter-nvim012.patch + +**Plugin:** nvim-treesitter +**Affects:** Neovim 0.12+ +**File patched:** `lua/nvim-treesitter/query_predicates.lua` + +### What it fixes + +Neovim 0.12 removed the `all` option from `add_directive`/`add_predicate`. +Match callbacks now always receive `TSNode[]` arrays instead of a single `TSNode`. +nvim-treesitter was not updated for this (the master branch was archived in May 2025), +causing a crash whenever treesitter injection queries run (e.g. opening a markdown file): + +``` +attempt to call method 'range' (a nil value) +``` + +### How to apply + +Run from the nvim-treesitter plugin directory: + +```sh +cd ~/.local/share/nvim/lazy/nvim-treesitter +git apply ~/.config/nvim/patches/nvim-treesitter-nvim012.patch +``` + +Or with the system `patch` command: + +```sh +cd ~/.local/share/nvim/lazy/nvim-treesitter +patch -p1 < ~/.config/nvim/patches/nvim-treesitter-nvim012.patch +``` diff --git a/desktop/nvim/patches/nvim-treesitter-nvim012.patch b/desktop/nvim/patches/nvim-treesitter-nvim012.patch new file mode 100644 index 0000000..651550a --- /dev/null +++ b/desktop/nvim/patches/nvim-treesitter-nvim012.patch @@ -0,0 +1,82 @@ +From: local fix +Subject: Fix query_predicates for Neovim 0.12 TSNode[] match format + +Neovim 0.12 removed the `all` option from add_directive/add_predicate. +Match callbacks now always receive TSNode[] (arrays) instead of a single +TSNode. nvim-treesitter assumed a single node; the nil-check passed +because arrays are truthy, then node:range() crashed on a plain table. + +Add a first_node() helper and use it everywhere match[id] is accessed. + +diff --git a/lua/nvim-treesitter/query_predicates.lua b/lua/nvim-treesitter/query_predicates.lua +index 7539170d..4fd7aef5 100644 +--- a/lua/nvim-treesitter/query_predicates.lua ++++ b/lua/nvim-treesitter/query_predicates.lua +@@ -18,6 +18,13 @@ local non_filetype_match_injection_language_aliases = { + -- compatibility shim for breaking change on nightly/0.11 + local opts = vim.fn.has "nvim-0.10" == 1 and { force = true, all = false } or true + ++-- Neovim 0.12 dropped the `all` option: match values are now TSNode[] not TSNode ++local function first_node(match, id) ++ local n = match[id] ++ if type(n) == "table" then n = n[1] end ++ return n ++end ++ + local function get_parser_from_markdown_info_string(injection_alias) + local match = vim.filetype.match { filename = "a." .. injection_alias } + return match or non_filetype_match_injection_language_aliases[injection_alias] or injection_alias +@@ -53,7 +60,7 @@ query.add_predicate("nth?", function(match, _pattern, _bufnr, pred) + return + end + +- local node = match[pred[2]] ---@type TSNode ++ local node = first_node(match, pred[2]) ---@type TSNode + local n = tonumber(pred[3]) + if node and node:parent() and node:parent():named_child_count() > n then + return node:parent():named_child(n) == node +@@ -74,7 +81,7 @@ query.add_predicate("is?", function(match, _pattern, bufnr, pred) + + -- Avoid circular dependencies + local locals = require "nvim-treesitter.locals" +- local node = match[pred[2]] ++ local node = first_node(match, pred[2]) + local types = { unpack(pred, 3) } + + if not node then +@@ -96,7 +103,7 @@ query.add_predicate("kind-eq?", function(match, _pattern, _bufnr, pred) + return + end + +- local node = match[pred[2]] ++ local node = first_node(match, pred[2]) + local types = { unpack(pred, 3) } + + if not node then +@@ -113,7 +120,7 @@ end, opts) + ---@return boolean|nil + query.add_directive("set-lang-from-mimetype!", function(match, _, bufnr, pred, metadata) + local capture_id = pred[2] +- local node = match[capture_id] ++ local node = first_node(match, capture_id) + if not node then + return + end +@@ -134,7 +141,7 @@ end, opts) + ---@return boolean|nil + query.add_directive("set-lang-from-info-string!", function(match, _, bufnr, pred, metadata) + local capture_id = pred[2] +- local node = match[capture_id] ++ local node = first_node(match, capture_id) + if not node then + return + end +@@ -154,7 +161,7 @@ query.add_directive("make-range!", function() end, opts) + ---@return boolean|nil + query.add_directive("downcase!", function(match, _, bufnr, pred, metadata) + local id = pred[2] +- local node = match[id] ++ local node = first_node(match, id) + if not node then + return + end diff --git a/desktop/waybar/config b/desktop/waybar/config index 00e1f79..5e90028 100644 --- a/desktop/waybar/config +++ b/desktop/waybar/config @@ -24,6 +24,7 @@ "hyprland/workspaces": { + "on-click": "activate", "format": " {icon} ", "format-icons": { "1": " ", diff --git a/desktop/wezterm/wezterm.lua b/desktop/wezterm/wezterm.lua index c6b852a..b1a496a 100644 --- a/desktop/wezterm/wezterm.lua +++ b/desktop/wezterm/wezterm.lua @@ -27,6 +27,8 @@ config.window_background_opacity = 0.92 config.use_fancy_tab_bar = false config.tab_bar_at_bottom = false +config.warn_about_missing_glyphs = false + -- Cursor config.default_cursor_style = "BlinkingBlock" config.cursor_blink_rate = 600 @@ -47,8 +49,16 @@ config.keys = { { key = "U", mods = "CTRL|SHIFT", action = wezterm.action.AttachDomain("unix") }, -- splits - { key = "h", mods = "ALT", action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }) }, - { key = "5", mods = "ALT", action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }) }, + { + key = "h", + mods = "ALT", + action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }), + }, + { + key = "5", + mods = "ALT", + action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }), + }, { key = "LeftArrow", mods = "ALT", action = wezterm.action.ActivatePaneDirection("Left") }, { key = "RightArrow", mods = "ALT", action = wezterm.action.ActivatePaneDirection("Right") }, { key = "UpArrow", mods = "ALT", action = wezterm.action.ActivatePaneDirection("Up") },