diff options
Diffstat (limited to '.config/nvim/lua/plugins/treesitter.lua')
| -rw-r--r-- | .config/nvim/lua/plugins/treesitter.lua | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..93f396d --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,93 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + branch = 'master', + dependencies = { + { 'nvim-treesitter/nvim-treesitter-refactor', lazy = false }, + { 'nvim-treesitter/nvim-treesitter-textobjects', lazy = false }, + -- { 'nvim-treesitter/playground', cmd = { 'TSPlayground' } }, + }, + lazy = false, + build = ':TSUpdate', + config = function(_, opts) + require('nvim-treesitter.configs').setup(opts) + + -- use bash parser for gentoo ebuilds + vim.treesitter.language.register('bash', 'ebuild') + end, + opts = { + ensure_installed = { + 'bash', + 'c', + 'cmake', + 'comment', + 'cpp', + 'css', + 'dockerfile', + 'go', + 'gomod', + 'gotmpl', + 'gowork', + 'html', + 'javascript', + 'json', + 'jsonc', + 'lua', + 'make', + 'markdown', + 'markdown_inline', + 'ninja', + 'python', + 'regex', + 'rust', + 'scss', + 'sql', + 'todotxt', + 'toml', + 'typescript', + 'typst', + 'vim', + 'vimdoc', + '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', + }, + }, + }, + }, + }, +} |