dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

treesitter.lua (1863B)


      1 return {
      2     "nvim-treesitter/nvim-treesitter",
      3     build = ":TSUpdate",
      4     config = function()
      5         require("nvim-treesitter.configs").setup({
      6             ensure_installed = {
      7                 "c", "lua", "rust", "python", "bash",
      8                 "html", "css", "typst", "markdown", "markdown_inline",
      9                 "vimdoc", "javascript", "typescript",
     10                 "jsdoc", "svelte", "glsl"
     11             },
     12             sync_install = true,
     13             auto_install = true,
     14             indent = {
     15                 enable = true
     16             },
     17             highlight = {
     18                 enable = true,
     19                 disable = function(lang, buf)
     20                     if lang == "html" then
     21                         print("disabled treesitter for html")
     22                         return true
     23                     end
     24                     local max_filesize = 100 * 1024 -- 100 KB
     25                     local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
     26                     if ok and stats and stats.size > max_filesize then
     27                         vim.notify(
     28                             "File larger than 100KB treesitter disabled for performance",
     29                             vim.log.levels.WARN,
     30                             { title = "Treesitter" }
     31                         )
     32                         return true
     33                     end
     34                 end,
     35 
     36                 -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
     37                 -- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
     38                 -- Using this option may slow down your editor, and you may see some duplicate highlights.
     39                 -- Instead of true it can also be a list of languages
     40                 -- additional_vim_regex_highlighting = { "markdown" },
     41             },
     42         })
     43     end
     44 }