From b339baf513c97c8f12f92ff4a4de58010987880c Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 24 Dec 2024 09:14:21 -0600 Subject: [PATCH] fixup nu neovim --- .../nvim/lua/plugins/language/nu.lua | 52 ++++++++++++++----- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/home/private_dot_config/nvim/lua/plugins/language/nu.lua b/home/private_dot_config/nvim/lua/plugins/language/nu.lua index 010857a..ad77906 100644 --- a/home/private_dot_config/nvim/lua/plugins/language/nu.lua +++ b/home/private_dot_config/nvim/lua/plugins/language/nu.lua @@ -1,18 +1,44 @@ -return require("util").if_exe("nu", { - { - "nvim-treesitter/nvim-treesitter", +return { + -- https://github.com/nushell/tree-sitter-nu/blob/dc22e2577eb09d1d0de50802c59da2eca98a0e7b/installation/neovim.md + "nvim-treesitter/nvim-treesitter", config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { "nu" }, -- Ensure the "nu" parser is installed - highlight = { - enable = true, -- Enable syntax highlighting - }, - }) + require("nvim-treesitter.configs").setup { + ensure_installed = { "nu" }, -- Ensure the "nu" parser is installed + highlight = { + enable = true, -- Enable syntax highlighting + }, + -- OPTIONAL!! These enable ts-specific textobjects. + -- So you can hit `yaf` to copy the closest function, + -- `dif` to clear the content of the closest function, + -- or whatever keys you map to what query. + textobjects = { + select = { + enable = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + -- For example: + -- Nushell only + ["aP"] = "@pipeline.outer", + ["iP"] = "@pipeline.inner", + + -- 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", + }, -- keymaps + }, -- select + }, -- textobjects + } end, dependencies = { - -- Additional Nushell parser - { "nushell/tree-sitter-nu", build = ":TSUpdate nu" }, + -- Install official queries and filetype detection + -- alternatively, see section "Install official queries only" + { "nushell/tree-sitter-nu" }, }, build = ":TSUpdate", - }, -}) +}