@@ -940,28 +940,34 @@ require('lazy').setup({
940940 },
941941 { -- Highlight, edit, and navigate code
942942 ' nvim-treesitter/nvim-treesitter' ,
943+ lazy = false ,
943944 build = ' :TSUpdate' ,
944- main = ' nvim-treesitter.configs' , -- Sets main module to use for opts
945- -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
946- opts = {
947- ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline' , ' query' , ' vim' , ' vimdoc' },
948- -- Autoinstall languages that are not installed
949- auto_install = true ,
950- highlight = {
951- enable = true ,
952- -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
953- -- If you are experiencing weird indenting issues, add the language to
954- -- the list of additional_vim_regex_highlighting and disabled languages for indent.
955- additional_vim_regex_highlighting = { ' ruby' },
956- },
957- indent = { enable = true , disable = { ' ruby' } },
958- },
945+ branch = ' main' ,
946+ -- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
947+ config = function ()
948+ local parsers = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline' , ' query' , ' vim' , ' vimdoc' }
949+ require (' nvim-treesitter' ).install (parsers )
950+
951+ vim .api .nvim_create_autocmd (' FileType' , {
952+ pattern = parsers ,
953+ callback = function ()
954+ -- enbales syntax highlighting and other treesitter features
955+ vim .treesitter .start ()
956+
957+ -- enbales treesitter based folds
958+ -- for more info on folds see `:help folds`
959+ -- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
960+
961+ -- enables treesitter based indentation
962+ vim .bo .indentexpr = " v:lua.require'nvim-treesitter'.indentexpr()"
963+ end ,
964+ })
965+ end ,
959966 -- There are additional nvim-treesitter modules that you can use to interact
960967 -- with nvim-treesitter. You should go explore a few and see what interests you:
961968 --
962- -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
963969 -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
964- -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
970+ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects (using the `main` branch)
965971 },
966972
967973 -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
0 commit comments