From d92bfab3203d63a20b571b7c782c458c5f8d251e Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sat, 3 Jun 2023 19:53:43 -0600 Subject: move treesitter to independent file --- lua/plugins/init.lua | 8 ------ lua/plugins/treesitter.lua | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 lua/plugins/treesitter.lua (limited to 'lua/plugins') diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 9478ab5..38e8c42 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -74,12 +74,4 @@ return { -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, - { - -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - }, - build = ':TSUpdate', - }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..4d3015a --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,69 @@ +return { + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + build = ':TSUpdate', + opts = { + ensure_installed = { 'go', 'lua', 'python', 'typescript', 'vimdoc', 'vim' }, + auto_install = false, + + highlight = { enable = true }, + indent = { enable = true, disable = { 'python' } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + -- Whether to set jumps in the jumplist + set_jumps = true, + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, + } +} -- cgit v1.2.3-70-g09d2