Setup treesitter with opts
#1695
-
This is my current treesitter setup: return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "VeryLazy",
config = function()
require("nvim-treesitter.configs").setup({
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
})
end,
} I want to switch to the |
Beta Was this translation helpful? Give feedback.
Answered by
Thibaulltt
Jul 31, 2024
Replies: 2 comments 3 replies
-
This is based on kickstart.nvim: return {
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
event = M.prenew,
cmd = 'TSUpdateSync',
build = ':TSUpdateSync',
opts = {
ensure_installed = {
'bash',
'c',
'diff',
'html',
'query',
'lua',
'luadoc',
'markdown',
'markdown_inline',
'vim',
'vimdoc',
},
sync_install = true,
auto_install = true,
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
},
config = function(_, opts)
-- Prefer git instead of curl in order to improve connectivity in some environments
require('nvim-treesitter.configs').setup(opts)
end,
} I hope this helps |
Beta Was this translation helpful? Give feedback.
2 replies
-
It should also be possible with the 'main' field in the return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
main = 'nvim-treesitter.configs',
opts = {
-- ...your options here...
},
} From the documentation: https://lazy.folke.io/spec#spec-setup |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
realguse
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should also be possible with the 'main' field in the
LazySpec
:From the documentation: https://lazy.folke.io/spec#spec-setup