summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/plugins/treesitter.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/plugins/treesitter.lua')
-rw-r--r--.config/nvim/lua/plugins/treesitter.lua73
1 files changed, 73 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..c454b48
--- /dev/null
+++ b/.config/nvim/lua/plugins/treesitter.lua
@@ -0,0 +1,73 @@
1return {
2 {
3 "nvim-treesitter/nvim-treesitter",
4 build = function()
5 pcall(require("nvim-treesitter.install").update({ with_sync = true }))
6 end,
7 dependencies = {
8 "nvim-treesitter/nvim-treesitter-textobjects",
9 },
10 config = function()
11 require("nvim-treesitter.configs").setup({
12 ensure_installed = { "bash", "bibtex", "c", "cpp", "css", "fish", "http", "latex", "lua", "python", "rust", "vim" },
13 ignore_install = { },
14 auto_install = true,
15 sync_install = false,
16 highlight = {
17 enable = true,
18 disable = { "latex" },
19 additional_vim_regex_highlighting = false,
20 },
21 indent = {
22 enable = true,
23 disable = { "python" }
24 },
25 incremental_selection = {
26 enable = true,
27 keymaps = {
28 init_selection = "gnn",
29 node_incremental = "grn",
30 scope_incremental = "grc",
31 node_decremental = "grm",
32 },
33 },
34 textobjects = {
35 select = {
36 enable = true,
37 lookahead = true, -- automatically jump forward to textobj, similar to targets.vim
38 keymaps = {
39 -- you can use the capture groups defined in textobjects.scm
40 ["aa"] = "@parameter.outer",
41 ["ia"] = "@parameter.inner",
42 ["af"] = "@function.outer",
43 ["if"] = "@function.inner",
44 ["ac"] = "@class.outer",
45 ["ic"] = "@class.inner",
46 },
47 },
48 move = {
49 enable = true,
50 set_jumps = true, -- whether to set jumps in the jumplist
51 goto_next_start = {
52 ["]m"] = "@function.outer",
53 ["]]"] = "@class.outer",
54 },
55 goto_next_end = {
56 ["]M"] = "@function.outer",
57 ["]["] = "@class.outer",
58 },
59 goto_previous_start = {
60 ["[m"] = "@function.outer",
61 ["[["] = "@class.outer",
62 },
63 goto_previous_end = {
64 ["[M"] = "@function.outer",
65 ["[]"] = "@class.outer",
66 },
67 },
68 },
69 modules = { },
70 })
71 end,
72 },
73}