@@ -2,10 +2,18 @@ return {
2
2
{ -- Highlight, edit, and navigate code
3
3
' nvim-treesitter/nvim-treesitter' ,
4
4
build = ' :TSUpdate' ,
5
+ dependencies = {
6
+ -- Additional text objects via treesitter
7
+ ' nvim-treesitter/nvim-treesitter-textobjects' ,
8
+ },
5
9
main = ' nvim-treesitter.configs' , -- Sets main module to use for opts
6
10
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
7
11
opts = {
8
- ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline' , ' query' , ' vim' , ' vimdoc' },
12
+ ensure_installed = {
13
+ " typescript" , " tsx" , " lua" , " javascript" , " vim" ,
14
+ " python" , " go" , " markdown" , " markdown_inline" , " bash" ,
15
+ " c" , " diff" , " html" , " luadoc" , " vimdoc" ,
16
+ },
9
17
-- Autoinstall languages that are not installed
10
18
auto_install = true ,
11
19
highlight = {
@@ -15,7 +23,63 @@ return {
15
23
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
16
24
additional_vim_regex_highlighting = { ' ruby' },
17
25
},
18
- indent = { enable = true , disable = { ' ruby' } },
26
+ indent = {
27
+ enable = true ,
28
+ disable = { ' python' , ' ruby' }
29
+ },
30
+ incremental_selection = {
31
+ enable = true ,
32
+ keymaps = {
33
+ init_selection = ' <c-space>' ,
34
+ node_incremental = ' <c-space>' ,
35
+ scope_incremental = ' <c-s>' ,
36
+ node_decremental = ' <c-backspace>' ,
37
+ },
38
+ },
39
+ textobjects = {
40
+ select = {
41
+ enable = true ,
42
+ lookahead = true ,
43
+ keymaps = {
44
+ -- You can use the capture groups defined in textobjects.scm
45
+ [' aa' ] = ' @parameter.outer' ,
46
+ [' ia' ] = ' @parameter.inner' ,
47
+ [' af' ] = ' @function.outer' ,
48
+ [' if' ] = ' @function.inner' ,
49
+ [' ac' ] = ' @class.outer' ,
50
+ [' ic' ] = ' @class.inner' ,
51
+ },
52
+ },
53
+ move = {
54
+ enable = true ,
55
+ set_jumps = true , -- whether to set jumps in the jumplist
56
+ goto_next_start = {
57
+ [' ]m' ] = ' @function.outer' ,
58
+ [' ]]' ] = ' @class.outer' ,
59
+ },
60
+ goto_next_end = {
61
+ [' ]M' ] = ' @function.outer' ,
62
+ [' ][' ] = ' @class.outer' ,
63
+ },
64
+ goto_previous_start = {
65
+ [' [m' ] = ' @function.outer' ,
66
+ [' [[' ] = ' @class.outer' ,
67
+ },
68
+ goto_previous_end = {
69
+ [' [M' ] = ' @function.outer' ,
70
+ [' []' ] = ' @class.outer' ,
71
+ },
72
+ },
73
+ swap = {
74
+ enable = true ,
75
+ swap_next = {
76
+ [' <leader>a' ] = ' @parameter.inner' ,
77
+ },
78
+ swap_previous = {
79
+ [' <leader>A' ] = ' @parameter.inner' ,
80
+ },
81
+ },
82
+ },
19
83
},
20
84
-- There are additional nvim-treesitter modules that you can use to interact
21
85
-- with nvim-treesitter. You should go explore a few and see what interests you:
@@ -24,4 +88,4 @@ return {
24
88
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
25
89
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
26
90
},
27
- }
91
+ }
0 commit comments