summaryrefslogtreecommitdiffstats
path: root/.config/nvim/plugin/10-treesitter.lua
blob: 941614cfdb7fee97a079688f7013be0017c3829f (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
--
-- 10-treesitter.lua
--
-- * Installs treesitter parsers.
-- * Creates an autocommand to start treesitter automatically.
--

require("nvim-treesitter").install({
	"bash",
	"diff",
	"gitcommit",
	"git_rebase",
	"ini",
	"json",
	"lua",
	"python",
	"readline",
	"vim",
	"vimdoc",
})

vim.api.nvim_create_autocmd("FileType", {
	desc = "Start treesitter",
	group = vim.g.dotfiles.augroup,
	callback = function(ev)
		local parser = vim.treesitter.get_parser(ev.buf)
		if not parser then
			return
		end
		vim.treesitter.start(ev.buf)
	end,
})