From 1951582c8447cf04c3c6a6ea65668f54f8f9111d Mon Sep 17 00:00:00 2001 From: Reathe Date: Sat, 31 Jan 2026 23:53:43 +0100 Subject: [PATCH] treesitter fix --- init.lua | 82 +++++++++++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 49 deletions(-) diff --git a/init.lua b/init.lua index 8365c1eb..29baec9a 100644 --- a/init.lua +++ b/init.lua @@ -855,62 +855,46 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', config = function() - local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } + require('nvim-treesitter').setup { + 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 + } + local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'nu' } require('nvim-treesitter').install(filetypes) vim.api.nvim_create_autocmd('FileType', { pattern = filetypes, callback = function() vim.treesitter.start() end, }) end, - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'nu' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - -- OPTIONAL!! These enable ts-specific textobjects. - -- So you can hit `yaf` to copy the closest function, - -- `dif` to clear the contet 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 - }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the