summaryrefslogtreecommitdiff
path: root/lua/ben/plugins/treesitter.lua
blob: b8f4ec0a2ccd545d3a7a9bd9e03e28f5d51bcc46 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
return {
	{
		"nvim-treesitter/nvim-treesitter",
		event = { "BufReadPre", "BufNewFile" },
		build = ":TSUpdate",
		dependencies = {
			"windwp/nvim-ts-autotag",
		},
		config = function()
			-- import nvim-treesitter plugin
			local treesitter = require("nvim-treesitter.configs")

			-- configure treesitter
			treesitter.setup({ -- enable syntax highlighting
				highlight = {
					enable = true,
				},
				-- enable indentation
				indent = { enable = true },
				-- enable autotagging (w/ nvim-ts-autotag plugin)
				autotag = { enable = true },
				-- ensure these language parsers are installed
				ensure_installed = {
					"json",
					"yaml",
					"html",
					"css",
					"javascript",
					"markdown",
					"markdown_inline",
					"graphql",
					"bash",
					"lua",
					"go",
					"gomod",
					"gowork",
					"gosum",
					"latex",
					"bibtex",
					"rnoweb",
					"org",
					"rust",
					"c",
					"cpp",
					"arduino",
					"vim",
					"make",
					"cmake",
					"mermaid",
					"passwd",
					"gpg",
					"regex",
					"awk",
					"sql",
					"ssh_config",
					"sxhkdrc",
					"nix",
					"xml",
					"csv",
					"dockerfile",
					"git_config",
					"git_rebase",
					"gitattributes",
					"gitcommit",
					"gitignore",
					"diff",
				},
				-- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx
				context_commentstring = {
					enable = true,
					enable_autocmd = false,
				},
				-- auto install above language parsers
				auto_install = true,
			})
		end,
	},
}