From 60f295c6ca6a851273b841d3c6ae2137565292d8 Mon Sep 17 00:00:00 2001 From: servostar Date: Thu, 7 Nov 2024 20:42:43 +0100 Subject: [PATCH] feat: add plugin `nvim-treesitter` --- lua/plugins/nvim-treesitter.lua | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lua/plugins/nvim-treesitter.lua diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..7cde894 --- /dev/null +++ b/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,41 @@ + +-- +-- Tree sitter syntax highlightning +-- +-- Source: https://github.com/nvim-treesitter/nvim-treesitter +-- https://www.lazyvim.org/plugins/treesitter +-- .............................................. +-- +-- Author: Sven Vogel +-- Created: 07.11.2024 +-- Edited: 07.11.2024 +-- +-- ============================================== + +return { + { + 'nvim-treesitter/nvim-treesitter', + version = false, -- last release is way too old and doesn't work on Windows + build = ":TSUpdate", + lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline + init = function(plugin) + -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early + -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which + -- no longer trigger the **nvim-treesitter** module to be loaded in time. + -- Luckily, the only things that those plugins need are the custom queries, which we make available + -- during startup. + require("lazy.core.loader").add_to_rtp(plugin) + require("nvim-treesitter.query_predicates") + end, + cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, + opts = { + auto_install = true, + highlight = { + enable = true + }, + indent = { + enable = true + } + } + } +}