diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index b8da240..a47a305 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -55,7 +55,7 @@ "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, - "nvim-treesitter": { "branch": "master", "commit": "cfc6f2c117aaaa82f19bcce44deec2c194d900ab" }, + "nvim-treesitter": { "branch": "master", "commit": "8b79cddc708cb8549562f0101f7f509ad7cebf97" }, "nvim-treesitter-context": { "branch": "master", "commit": "198720b4016af04c9590f375d714d5bf8afecc1a" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "cb718aab7fa66e43187674e875713097492a6618" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "abcbb0e537c9c24800b03b9ca33bee5806604629" }, @@ -72,6 +72,7 @@ "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" }, "texpresso.vim": { "branch": "main", "commit": "907838c08bbf99ad6bed3c908f1d0551a92ab4e0" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "tree-sitter-nu": { "branch": "main", "commit": "c10340b5bb3789f69182acf8f34c3d4fc24d2fe1" }, "trouble.nvim": { "branch": "main", "commit": "748ca2789044607f19786b1d837044544c55e80a" }, "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" }, "typst-preview.nvim": { "branch": "master", "commit": "00ff6829030f302e8ff24d0e3a68625dd1a3ac40" }, diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 8ed1ff5..f155814 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -17,11 +17,16 @@ return { require("rainbow-delimiters.setup").setup({}) end, }, + { "nushell/tree-sitter-nu", version = false }, }, + version = false, -- TODO: Can be set to versioned if new version after 2024-12-12 is released config = function() + ---@diagnostic disable-next-line: missing-fields (seems an issue in the diagnostic) require("nvim-treesitter.configs").setup({ -- one of "all", "maintained" (parsers with maintainers), or a list of languages ensure_installed = "all", + ignore_install = {}, + sync_install = false, auto_install = true, highlight = { enable = true, @@ -39,7 +44,23 @@ return { additional_vim_regex_highlighting = false, }, incremental_selection = { enable = true }, - textobjects = { enable = true }, + textobjects = { + enable = true, + -- TODO: CHECK IF ANY CONFLICTING WITH MINI AI!! + -- supported in other languages as well + ["aF"] = "@function.outer", + ["iF"] = "@function.inner", + ["aL"] = "@loop.outer", + ["iL"] = "@loop.inner", + ["aC"] = "@conditional.outer", + ["iC"] = "@conditional.inner", + ["iS"] = "@statement.inner", + ["aS"] = "@statement.outer", + + -- Nushell only + ["aP"] = "@pipeline.outer", + ["iP"] = "@pipeline.inner", + }, indent = { enable = true }, autotag = { enable = true }, @@ -65,19 +86,6 @@ return { nu = "# %s", }, }) - - -- treesitter parser for nushell. To fully get e.g. syntax highlight - -- working you need a highlight file too. For now I installed manually, see: - -- https://github.com/nushell/tree-sitter-nu/blob/main/installation/neovim.md - local parser_config = require("nvim-treesitter.parsers").get_parser_configs() - parser_config.nu = { - install_info = { - url = "https://github.com/nushell/tree-sitter-nu", - files = { "src/parser.c" }, - branch = "main", - }, - filetype = "nu", - } end, event = { "VeryLazy" }, cmd = {