vim.pack.add ({
    'https://github.com/nvim-treesitter/nvim-treesitter'
})

require('nvim-treesitter').setup {
  -- Directory to install parsers and queries to (prepended to `runtimepath` to have priority)
  install_dir = vim.fn.stdpath('data') .. '/site'
}
-- Required parsers and queries
require('nvim-treesitter').install { 'lua', 'nix', 'javascript', 'html', 'css', 'c', 'cpp', 'python', 'kdl', 'markdown', 'qmldir' }

-- Syntax highlighting
vim.api.nvim_create_autocmd('FileType', {
  pattern = { 'lua', 'nix', 'javascript', 'html', 'css', 'c', 'cpp', 'python', 'kdl', 'markdown', 'qmldir' },
  callback = function() vim.treesitter.start() end,
})

-- Auto indentation
vim.api.nvim_create_autocmd('FileType', {
  callback = function() vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end,
})
