Skip to content

Commit bacd097

Browse files
committed
update to new treesitter config
they changed to new 'main' branch instead of master. Which breaks the config see: nvim-lua/kickstart.nvim#1657 for solution applied
1 parent 7f9a3e5 commit bacd097

File tree

1 file changed

+27
-45
lines changed

1 file changed

+27
-45
lines changed

nvim/lua/plugins/treesitter.lua

Lines changed: 27 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,30 @@
11
return {
2-
{
3-
"nvim-treesitter/nvim-treesitter",
4-
build = ":TSUpdate",
5-
branch = "main",
2+
{
3+
"nvim-treesitter/nvim-treesitter",
4+
lazy = false,
5+
build = ":TSUpdate",
6+
branch = 'main',
67
dependencies = {"nvim-treesitter/nvim-treesitter-context"},
7-
config = function()
8-
require 'nvim-treesitter.configs'.setup {
9-
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
10-
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "php" },
11-
12-
-- Automatically install missing parsers when entering buffer
13-
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
14-
auto_install = true,
15-
16-
sync_install = false,
17-
18-
ignore_install = { "javascript" },
19-
20-
modules = {},
21-
22-
indent = { enable = true },
23-
24-
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
25-
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
26-
27-
highlight = {
28-
enable = true,
29-
30-
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
31-
disable = function(lang, buf)
32-
local max_filesize = 100 * 1024 -- 100 KB
33-
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
34-
if ok and stats and stats.size > max_filesize then
35-
return true
36-
end
37-
end,
38-
39-
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
40-
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
41-
-- Using this option may slow down your editor, and you may see some duplicate highlights.
42-
-- Instead of true it can also be a list of languages
43-
additional_vim_regex_highlighting = false,
44-
},
45-
}
46-
end
47-
}
8+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
9+
config = function()
10+
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim',
11+
'vimdoc', 'php' }
12+
require('nvim-treesitter').install(parsers)
13+
14+
vim.api.nvim_create_autocmd('FileType', {
15+
pattern = parsers,
16+
callback = function()
17+
-- enbales syntax highlighting and other treesitter features
18+
vim.treesitter.start()
19+
20+
-- enbales treesitter based folds
21+
-- for more info on folds see `:help folds`
22+
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
23+
24+
-- enables treesitter based indentation
25+
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
26+
end,
27+
})
28+
end,
29+
}
4830
}

0 commit comments

Comments
 (0)