diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2026-09-27 12:46:49 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2026-09-27 12:46:49 -0300 |
| commit | df7c711e2a49d51249350f52c63274b72aacb739 (patch) | |
| tree | 426da3b65371f857f3ee3d9893d7ff3279aac02e /lua/plugins/treesitter.lua | |
| parent | a0bd84df02ce235123dfc939327e8bd33dffdd7e (diff) | |
| download | nvim-conf-df7c711e2a49d51249350f52c63274b72aacb739.tar.gz nvim-conf-df7c711e2a49d51249350f52c63274b72aacb739.zip | |
Migración de plugins a funcionalidad nativa: statusline y treesitter propios, se quitan mason, lualine, mini, notify y otros
Diffstat (limited to 'lua/plugins/treesitter.lua')
| -rw-r--r-- | lua/plugins/treesitter.lua | 182 |
1 files changed, 43 insertions, 139 deletions
diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index aa17471..7469e17 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,147 +1,51 @@ return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - dependencies = { - 'RRethy/nvim-treesitter-endwise', - "nvim-treesitter/nvim-treesitter-textobjects", - 'nvim-treesitter/playground', - }, - event = { 'BufReadPre', 'BufNew', 'BufNewFile' }, - main = "nvim-treesitter.configs", - cmd = { - 'TSBufDisable', - 'TSBufEnable', - 'TSBufToggle', - 'TSConfigInfo', - 'TSDisable', - 'TSEditQuery', - 'TSEditQueryUserAfter', - 'TSEnable', - 'TSInstall', - 'TSInstallFromGrammar', - 'TSInstallInfo', - 'TSInstallSync', - 'TSModuleInfo', - 'TSToggle', - 'TSUninstall', - 'TSUpdate', - 'TSUpdateSync', - 'TSPlaygroundToggle', + { + -- Rama `main`: reescritura completa, es la única que soporta Neovim >= 0.12. + -- No soporta lazy-loading. + "nvim-treesitter/nvim-treesitter", + branch = "main", + lazy = false, + build = ":TSUpdate", + config = function() + require("pi.treesitter").setup() + end, }, - opts = { - endwise = { - enable = true, - disable = { "markdown", "markdown_inline" }, - }, - auto_install = true, - ensure_installed = { - "bash", - "blade", - "css", - "go", - "gomod", - "html", - "javascript", - "json", - "lua", - "luadoc", - "markdown", - "markdown_inline", - "typst", - "nix", - "org", - "php", - "php_only", - "phpdoc", - "query", - "rust", - "sql", - "svelte", - "typescript", - "twig", - "regex", - "vim", - "yaml", - "latex", - "python", - "dockerfile", - "cpp", - "elixir", - "erlang", - }, - highlight = { - enable = true, - disable = function(_, buf) - local ft = vim.bo[buf].filetype - return ft == "oil" or ft == "snacks_notif" - end, - additional_vim_regex_highlighting = { "org" }, - }, - playground = { - enable = true, - disable = {}, - updatetime = 25, -- Tiempo de actualización en milisegundos para la consulta del árbol. - persist_queries = false, -- Si se debe persistir las consultas entre sesiones. - }, - query_linter = { - enable = true, - use_virtual_text = true, - lint_events = {"BufWrite", "CursorHold"}, - }, - indent = { - enable = true, - disable = { "oil", "snacks_notif" }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@conditional.outer", - ["ic"] = "@conditional.inner", - ["al"] = "@loop.outer", - ["il"] = "@loop.inner", - }, - }, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - }, - }, - }, - config = function(plug, config) - local parser_config = require "nvim-treesitter.parsers".get_parser_configs() - parser_config.blade = { - install_info = { - url = "https://github.com/EmranMR/tree-sitter-blade", - files = {"src/parser.c"}, - branch = "main", - }, - filetype = "blade" - } - vim.filetype.add({ - pattern = { - ['.*%.blade%.php'] = 'blade', + { + "nvim-treesitter/nvim-treesitter-textobjects", + branch = "main", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("nvim-treesitter-textobjects").setup { + select = { + lookahead = true, + }, } - }) - -- Reuse markdown parser for plugin-specific scratch buffers. - vim.treesitter.language.register("markdown", "codecompanion") - vim.treesitter.language.register("markdown", "snacks_notif") - vim.treesitter.language.register("markdown", "oil") + local select = require "nvim-treesitter-textobjects.select" + local objects = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@conditional.outer", + ["ic"] = "@conditional.inner", + ["al"] = "@loop.outer", + ["il"] = "@loop.inner", + } - -- Some markdown injections generated by external plugins can point to - -- placeholder languages and crash parser injection resolution. - pcall(vim.treesitter.query.set, "markdown", "injections", "") + for lhs, query in pairs(objects) do + vim.keymap.set({ "x", "o" }, lhs, function() + select.select_textobject(query, "textobjects") + end, { desc = "Textobject " .. query }) + end + end, + }, - require(plug.main).setup(config); - end, + { + -- Se auto-inicializa desde su plugin/; en Neovim >= 0.9 no usa el sistema de + -- módulos de nvim-treesitter, así que funciona igual con la rama `main`. + "RRethy/nvim-treesitter-endwise", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + event = { "BufReadPre", "BufNewFile" }, + }, } |