From 11863aa710ab0626eb76648d101854a481664a34 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 24 Jun 2024 16:45:18 +0800 Subject: Update --- vim/lua/configs/treesitter.lua | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 vim/lua/configs/treesitter.lua (limited to 'vim/lua/configs/treesitter.lua') diff --git a/vim/lua/configs/treesitter.lua b/vim/lua/configs/treesitter.lua new file mode 100644 index 0000000..8375d5b --- /dev/null +++ b/vim/lua/configs/treesitter.lua @@ -0,0 +1,62 @@ +return { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'bash', 'c', 'html', 'css', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = true, + + -- highlight = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + 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, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']f'] = '@function.outer', + [']c'] = '@class.outer', + }, + goto_next_end = { + [']F'] = '@function.outer', + [']C'] = '@class.outer', + }, + goto_previous_start = { + ['[f'] = '@function.outer', + ['[c'] = '@class.outer', + }, + goto_previous_end = { + ['[F'] = '@function.outer', + ['[C'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, +} -- cgit v1.2.3-70-g09d2