Skip to content

Commit

Permalink
Tree sitter compat w/ nushell
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart committed Dec 20, 2024
1 parent cfc6e04 commit 7a6c641
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion plugin/after/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,32 @@ require'nvim-treesitter.configs'.setup {

additional_vim_regex_highlighting = false,
},
-- 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
}, --
}

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
Expand All @@ -30,7 +56,7 @@ parser_config.ejs = {
parser_config.nu = {
install_info = {
url = "https://github.com/nushell/tree-sitter-nu",
files = { "src/parser.c" },
files = { "src/parser.c", "src/scanner.c" },
branch = "main",
},
filetype = "nu",
Expand Down

0 comments on commit 7a6c641

Please sign in to comment.