From 85c1157b9f61d7278cda1c0e9d1235fa9e889049 Mon Sep 17 00:00:00 2001 From: zymon Date: Mon, 26 Aug 2024 12:31:38 +0200 Subject: [PATCH] initial treesitter config --- lua/znvim/options.lua | 2 + lua/znvim/plugins/treesitter.lua | 75 ++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 lua/znvim/plugins/treesitter.lua diff --git a/lua/znvim/options.lua b/lua/znvim/options.lua index 342c3a6..274af18 100644 --- a/lua/znvim/options.lua +++ b/lua/znvim/options.lua @@ -73,3 +73,5 @@ vim.opt.foldcolumn = "4" vim.opt.foldlevel = 99 vim.opt.foldlevelstart = 99 vim.opt.fillchars = "eob: ,fold: ,foldopen:,foldsep: ,foldclose:" +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "nvim_treesitter#foldexpr()" diff --git a/lua/znvim/plugins/treesitter.lua b/lua/znvim/plugins/treesitter.lua new file mode 100644 index 0000000..c8fcfcc --- /dev/null +++ b/lua/znvim/plugins/treesitter.lua @@ -0,0 +1,75 @@ +return { + + { -- treesitter + "https://github.com/nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + event = "BufReadPre", + opts = { + highlight = { enable = true, }, + indent = { enable = true }, + ensure_installed = { + "asm", + "bash", + "bibtex", + "c", + "cmake", + "commonlisp", + "cpp", + "css", + "csv", + "cuda", + "d", + "devicetree", + "diff", + "dockerfile", + "erlang", + "elixir", + "heex", + "fennel", + "fortran", + "git_config", "git_rebase", "gitattributes", "gitcommit", "gitignore", + "haskell", + "html", + "http", + "javascript", + "json", "json5", + "julia", + "latex", + "llvm", + "lua", "luadoc", + "markdown", "markdown_inline", + "norg", + "objdump", + "passwd", + "python", + "regex", + "rst", + "rust", + "sql", + "ssh_config", + "systemverilog", + "tcl", + "toml", + "typst", + "verilog", + "vhdl", + "vim", + "vimdoc", + "xml", + "yaml", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }, + config = function (_, opts) + require("nvim-treesitter.configs").setup(opts) + end + }, +}