update nvim-treesitter to main

This commit is contained in:
Alexander Navarro 2025-09-04 10:46:28 -04:00
parent 41f458954a
commit 7e24245690
3 changed files with 60 additions and 49 deletions

View file

@ -20,10 +20,10 @@
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" }, "nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" },
"nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" }, "nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" },
"nvim-treesitter": { "branch": "master", "commit": "8d4fdc5e47e2a4e00179e43f56221250ce365973" }, "nvim-treesitter": { "branch": "main", "commit": "802195d8f1980db25a7a39a55f9a25df21756c73" },
"nvim-treesitter-context": { "branch": "master", "commit": "6b081ea63a3711243d11540ce28ccdb6f35ecd33" }, "nvim-treesitter-context": { "branch": "master", "commit": "66a9b5fa9e806918b5fe3dba00c6cce7e230abd2" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, "nvim-treesitter-textobjects": { "branch": "main", "commit": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-web-devicons": { "branch": "master", "commit": "edbe0a65cfacbbfff6a4a1e98ddd60c28c560509" }, "nvim-web-devicons": { "branch": "master", "commit": "edbe0a65cfacbbfff6a4a1e98ddd60c28c560509" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"render-markdown": { "branch": "main", "commit": "6096cf3608b576a38fd1396227dbc0473091714d" }, "render-markdown": { "branch": "main", "commit": "6096cf3608b576a38fd1396227dbc0473091714d" },

View file

@ -163,6 +163,7 @@ vim.lsp.enable({
"bashls", "bashls",
"biome", "biome",
"fish_lsp", "fish_lsp",
"gleam",
"hyprls", "hyprls",
"intelephense", "intelephense",
"jsonls", "jsonls",

View file

@ -1,50 +1,60 @@
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
lazy = false, lazy = false,
branch = "master", branch = "main",
dependencies = { dependencies = {
{ {
"JoosepAlviste/nvim-ts-context-commentstring", "JoosepAlviste/nvim-ts-context-commentstring",
opts = { opts = {
enable_autocmd = false, enable_autocmd = false,
}, },
}, },
{ "nvim-treesitter/nvim-treesitter-context" }, { "nvim-treesitter/nvim-treesitter-context" },
}, },
build = ":TSUpdate", build = ":TSUpdate",
opts = { opts = {
auto_install = true, auto_install = true,
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
}, },
}, init = function()
{ -- HACK: for filetypes that doesn't start treesitter hightlight on it's own
"nvim-treesitter/nvim-treesitter-textobjects", vim.api.nvim_create_autocmd("FileType", {
dependencies = { "nvim-treesitter", }, pattern = { "gleam" },
config = function() callback = function()
require 'nvim-treesitter.configs'.setup({ vim.treesitter.start()
textobjects = { end,
move = { })
enable = true, end,
set_jumps = true, -- whether to set jumps in the jumplist },
goto_next = { {
["]]"] = { query = { "@block.outer", "@function.outer", "@class.outer", } }, "nvim-treesitter/nvim-treesitter-textobjects",
}, dependencies = { "nvim-treesitter" },
goto_previous = { branch = "main",
["[["] = { query = { "@block.outer", "@function.outer", "@class.outer", } }, config = function()
} local ts_obj = require("nvim-treesitter-textobjects")
},
},
})
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move" ts_obj.setup({
move = {
set_jumps = true,
},
})
-- Repeat movement with ; and , vim.keymap.set({ "n", "x", "o" }, "]]", function()
-- ensure ; goes forward and , goes backward regardless of the last direction ts_obj.move.goto_next({ "@block.outer", "@function.outer", "@class.outer" }, "textobjects")
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_previous) end)
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_next)
end
}
vim.keymap.set({ "n", "x", "o" }, "[[", function()
ts_obj.move.goto_previous({ "@block.outer", "@function.outer", "@class.outer" }, "textobjects")
end)
local ts_repeat_move = require("nvim-treesitter-textobjects.repeatable_move")
-- Repeat movement with ; and ,
-- ensure ; goes forward and , goes backward regardless of the last direction
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_opposite)
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move)
end,
},
} }