summaryrefslogtreecommitdiff
path: root/.config/nvim/after/plugin/treesitter.lua
blob: 77a32181bdf5473ce49833cc8aa043ace1dea4ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require('nvim-treesitter.configs').setup {
	ensure_installed = {
		'c',
		'go',
		'gomod',
		'html',
		'lua',
		'python',
		'query',
		'rust',
		'vim',
		'vimdoc',
		'zig',
	},

	sync_install = false,
	auto_install = true,

	highlight = {
		enable = true,
		additional_vim_regex_highlighting = false,
	},

	incremental_selection = {
		enable = true,
		keymaps = {
			init_selection = '<C-Space>',
			node_incremental = '<C-Space>',
			scope_incremental = '<C-s>',
			node_decremental = '<C-Backspace>',
		}
	},

	textobjects = {
		select = {
			enable = true,
			lookahead = true,
			keymaps = {
				['af'] = '@function.outer',
				['if'] = '@function.inner',
				['ab'] = '@block.outer',
				['ib'] = '@block.inner',
			},
		},
		move = {
			enable = true,
			set_jumps = true,
			goto_next_start = {
				[']f'] = '@function.outer',
				[']b'] = '@block.outer',
			},
			goto_next_end = {
				[']F'] = '@function.outer',
				[']B'] = '@block.outer',
			},
			goto_previous_start = {
				['[f'] = '@function.outer',
				['[b'] = '@block.outer',
			},
			goto_previous_end = {
				['[F'] = '@function.outer',
				['[B'] = '@block.outer',
			},
		},
	},
}