From 0d3d49ddf418e5bb09c013abd2904628b5defd66 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Mon, 26 May 2025 02:48:43 +0200 Subject: [PATCH] Update treesitter to main --- git/dot-gitconfig | 2 ++ nvim/dot-config/nvim/lazy-lock.json | 6 ++--- nvim/dot-config/nvim/lua/autocmds.lua | 12 +++++++++ .../nvim/lua/plugins/treesitter.lua | 26 ++++--------------- nvim/dot-config/nvim/lua/tools/highlight.lua | 16 ++++++++++++ 5 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 nvim/dot-config/nvim/lua/tools/highlight.lua diff --git a/git/dot-gitconfig b/git/dot-gitconfig index 293bb3a..10863fa 100644 --- a/git/dot-gitconfig +++ b/git/dot-gitconfig @@ -4,6 +4,8 @@ [includeIf "gitdir:~/Projects/ALTEN/"] path = ~/.dotfiles/git/profiles/ALTEN +[includeIf "gitdir:~/Projects/vlasman/"] + path = ~/.dotfiles/git/profiles/ALTEN [filter "lfs"] process = git-lfs filter-process required = true diff --git a/nvim/dot-config/nvim/lazy-lock.json b/nvim/dot-config/nvim/lazy-lock.json index 8a9bcff..9b3338d 100644 --- a/nvim/dot-config/nvim/lazy-lock.json +++ b/nvim/dot-config/nvim/lazy-lock.json @@ -35,9 +35,9 @@ "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-lspconfig": { "branch": "master", "commit": "3ea99227e316c5028f57a4d86a1a7fd01dd876d0" }, "nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-context": { "branch": "master", "commit": "938003c79d23912d2cafd56d939346860f78127a" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" }, + "nvim-treesitter": { "branch": "main", "commit": "c1dfc39285e4a11983dfbe556fb0be7f2a749977" }, + "nvim-treesitter-context": { "branch": "master", "commit": "404502e607c3b309e405be9112c438c721153372" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "fa32a45fdbab9c9c3bda9ecec9b12dddb221b927" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, diff --git a/nvim/dot-config/nvim/lua/autocmds.lua b/nvim/dot-config/nvim/lua/autocmds.lua index d303cb4..fe6eb83 100644 --- a/nvim/dot-config/nvim/lua/autocmds.lua +++ b/nvim/dot-config/nvim/lua/autocmds.lua @@ -32,3 +32,15 @@ vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, { group = cursor_group, pattern = "*", }) + +vim.api.nvim_create_autocmd("FileType", { + pattern = require("tools.highlight"), + callback = function() + -- syntax highlighting, provided by Neovim + vim.treesitter.start() + -- folds, provided by Neovim + vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" + -- indentation, provided by nvim-treesitter + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, +}) diff --git a/nvim/dot-config/nvim/lua/plugins/treesitter.lua b/nvim/dot-config/nvim/lua/plugins/treesitter.lua index 7b3556e..dd68e1f 100644 --- a/nvim/dot-config/nvim/lua/plugins/treesitter.lua +++ b/nvim/dot-config/nvim/lua/plugins/treesitter.lua @@ -4,27 +4,15 @@ return { "nvim-treesitter/nvim-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter-context", - "nvim-treesitter/nvim-treesitter-textobjects", + { "nvim-treesitter/nvim-treesitter-textobjects", branch = "main" }, "windwp/nvim-ts-autotag", }, + lazy = false, + branch = "main", + build = ":TSUpdate", opts = { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { - "c", - "cpp", - "go", - "lua", - "python", - "rust", - "tsx", - "typescript", - "vimdoc", - "vim", - "markdown", - "markdown_inline", - "bash", - "sql", - }, + ensure_installed = require("tools.highlight"), -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = true, @@ -91,10 +79,6 @@ return { enable = true, }, }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - require("nvim-treesitter.install").update({ with_sync = true }) - end, }, { "nvim-treesitter/nvim-treesitter-context", diff --git a/nvim/dot-config/nvim/lua/tools/highlight.lua b/nvim/dot-config/nvim/lua/tools/highlight.lua new file mode 100644 index 0000000..076580a --- /dev/null +++ b/nvim/dot-config/nvim/lua/tools/highlight.lua @@ -0,0 +1,16 @@ +return { + "c", + "cpp", + "go", + "lua", + "python", + "rust", + "tsx", + "typescript", + "vimdoc", + "vim", + "markdown", + "markdown_inline", + "bash", + "sql", +}