From 3f5579b3507c5bc6b5ae2eb322de3848e7e2a812 Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Mon, 4 Sep 2023 03:42:41 +0200 Subject: [PATCH] Update treesitter config --- lua/config/treesitter.lua | 69 +++++++++++++++++++++++++-------------- lua/core/options.lua | 4 +-- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua index 980a3a8..9cb32a2 100644 --- a/lua/config/treesitter.lua +++ b/lua/config/treesitter.lua @@ -17,53 +17,72 @@ -- https://github.com/nvim-treesitter/nvim-treesitter require("nvim-treesitter.configs").setup({ - -- One of "all", "maintained" (parsers with maintainers), or a list of languages ensure_installed = { "bash", "c", - "cpp", "cmake", + "comment", + "cpp", "css", + "csv", + -- "d", -- requires treesitter cli? + "diff", "dockerfile", - "go", + "doxygen", + "dtd", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "groovy", + "hare", "html", + "ini", "java", "javascript", "json", + "json5", + "jsonc", + "latex", "lua", + "luadoc", + "luap", "make", + "markdown", + "markdown_inline", + "meson", "ninja", + "norg", + "odin", + "perl", + "php", + "phpdoc", + "pymanifest", "python", + "regex", + "requirements", + "robot", + "rst", "rust", + "sql", "toml", + "typescript", "vim", + "vimdoc", + "xml", "yaml", "yang", + "zig", }, + -- Indentation based on treesitter for the = operator. + -- NOTE: This is an experimental feature. indent = { enable = true, }, - - -- Install languages synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- List of parsers to ignore installing - ignore_install = {}, - - highlight = { - -- `false` will disable the whole extension - enable = true, - - -- list of language that will be disabled - disable = {}, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, }) --- vim.opt.foldmethod = "expr" --- vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.opt.foldenable = false diff --git a/lua/core/options.lua b/lua/core/options.lua index 62ec297..c0d24ac 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -28,9 +28,7 @@ vim.opt.softtabstop = 4 vim.opt.expandtab = true vim.opt.shiftwidth = 4 vim.opt.smarttab = false --- Folds are configured in nvim-treesitter, but this needs to be set before --- loading the first buffer which is not possible in nvim-treesitter.lua due to --- lazy loading (I think) +-- Folds are configured in nvim-treesitter, so this is only for fallback vim.opt.foldlevelstart = 99 vim.opt.foldmethod = "indent" vim.opt.foldignore = ""