From d4620f3ac119263fee90bd819eadaf84fc8d50b7 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 8 Apr 2026 13:11:48 +0900 Subject: * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated-commit-by: dots Signed-off-by: Robert Günzler --- .config/nvim/lua/plugins/treesitter.lua | 65 +++++++++------------------------ 1 file changed, 17 insertions(+), 48 deletions(-) (limited to '.config/nvim/lua/plugins/treesitter.lua') diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index e064a8b..0978eb7 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,19 +1,26 @@ return { { 'nvim-treesitter/nvim-treesitter', - branch = 'master', + branch = 'main', lazy = false, - dependencies = { - { 'nvim-treesitter/nvim-treesitter-refactor', lazy = false }, - { 'nvim-treesitter/nvim-treesitter-textobjects', lazy = false }, - -- { 'nvim-treesitter/playground', cmd = { 'TSPlayground' } }, - }, build = ':TSUpdate', config = function(_, opts) - require('nvim-treesitter.configs').setup(opts) - - -- use bash parser for gentoo ebuilds - vim.treesitter.language.register('bash', 'ebuild') + -- enable indent + vim.api.nvim_create_autocmd('FileType', { + callback = function() + pcall(vim.treesitter.start) + vim.bo.indentexpr = [[v:lua.require'nvim-treesitter'.indentexpr()]] + end, + }) + -- auto-install + local already_installed = require('nvim-treesitter').get_installed() + local parsers_installable = vim + .iter(opts.ensure_installed) + :filter(function(parser) + return not vim.tbl_contains(already_installed, parser) + end) + :totable() + require('nvim-treesitter').install(parsers_installable) end, opts = { ensure_installed = { @@ -31,7 +38,6 @@ return { 'html', 'javascript', 'json', - 'jsonc', 'lua', 'make', 'markdown', @@ -51,43 +57,6 @@ return { 'yaml', 'zig', }, - highlight = { - enable = true, - additional_vim_regex_highlighting = { 'markdown' }, - }, - indent = { - enable = true, - }, - refactor = { - navigation = { - enable = true, - }, - smart_rename = { - enable = true, - }, - }, - textobjects = { - select = { - enable = true, - keymaps = { - ['ib'] = '@block.inner', - ['ab'] = '@block.outer', - -- ['ic'] = '@conditional.inner', - -- ['ac'] = '@conditional.outer', - ['if'] = '@function.inner', - ['af'] = '@function.outer', - ['il'] = '@loop.inner', - ['al'] = '@loop.outer', - ['is'] = '@scopename.inner', - ['as'] = '@scopename.outer', - ['ic'] = '@comment.inner', - ['ac'] = '@comment.outer', - }, - selection_mode = { - ['@comment.outer'] = 'V', - }, - }, - }, }, }, } -- cgit 1.4.1