DEVELOPMENT ENVIRONMENT

~alex/dotfiles

ref: 3e6f6ae919f6c375b2b50711156a5fff12d9128f dotfiles/nvim/lua/plugins/treesitter.lua -rw-r--r-- 1.2 KiB
3e6f6ae9 — Alejandro Laguna chore: update readme 16 days ago
                                                                                
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
return {
	"nvim-treesitter/nvim-treesitter",
	version = false, -- Last release is way too old
	build = ":TSUpdate",
	-- event = { "BufReadPost", "BufNewFile" },
	lazy = false, -- Keep false to ensure loading for Neo-tree
	main = "nvim-treesitter.configs", -- Lazy handles the require logic here
	branch = "master", -- Explicitly force the stable branch
	opts = {
		ensure_installed = {
			"lua",
			"vim",
			"vimdoc",
			"query",
			"python",
			"c",
			"cpp",
			"csv",
			"json",
		},
		ignore_install = { "markdown", "markdown_inline" },
		auto_install = false,
		highlight = {
			enable = true,
			-- Disable treesitter for markdown to prevent crashes
			disable = { "markdown", "markdown_inline", "bash" },
			additional_vim_regex_highlighting = { "markdown" },
		},

		indent = {
			enable = true,
			disable = { "markdown", "markdown_inline" },
		},
		injections = {
			enable = false,
		},
	},
	-- Fallback config to handle edge cases
	config = function(_, opts)
		-- Protective call: If treesitter fails to load, don't crash neovim
		local status_ok, configs = pcall(require, "nvim-treesitter.configs")
		if not status_ok then
			return
		end
		configs.setup(opts)
	end,
}