diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 7a710e9..0ac5198 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,3 +1,16 @@ +-- This hook checks for a treesitter update, verifies that the plugin +-- is active and runs TSUpdate +-- !! It needs to be defined before vim.pack.add to work +vim.api.nvim_create_autocmd('PackChanged', { + callback = function(ev) + local name, kind = ev.data.spec.name, ev.data.kind + if name == 'nvim-treesitter' and kind == 'update' then + if not ev.data.active then vim.cmd.packadd('nvim-treesitter') end + vim.cmd('TSUpdate') + end + end +}) + vim.pack.add({ { src = 'https://github.com/nvim-treesitter/nvim-treesitter', name = 'treesitter', branch = 'main' }, { src = 'https://github.com/nvim-treesitter/nvim-treesitter-context', name = 'treesitter-context' }, diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index 9bf4727..96706a1 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -29,28 +29,16 @@ "rev": "8d82c240f190fc33723d48c308ccc1ed8baad69d", "src": "https://github.com/lewis6991/gitsigns.nvim" }, - "markdown-preview": { - "rev": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee", - "src": "https://github.com/iamcco/markdown-preview.nvim" - }, - "markdown-preview.nvim": { - "rev": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee", - "src": "https://github.com/iamcco/markdown-preview.nvim" - }, "nvim-lspconfig": { - "rev": "cb5bc0b2b35a6d513e3298d285db81453e791f4f", + "rev": "4b7fbaa239c5db6b36f424a4521ca9f1a401be33", "src": "https://github.com/neovim/nvim-lspconfig" }, - "peekup": { - "rev": "82251c54cd60f8504dfd9acd853eae57fe832447", - "src": "https://github.com/gennaro-tedesco/nvim-peekup" - }, "plenary": { "rev": "74b06c6c75e4eeb3108ec01852001636d85a932b", "src": "https://github.com/nvim-lua/plenary.nvim" }, "telescope": { - "rev": "f7c673b8e46e8f233ff581d3624a517d33a7e264", + "rev": "471eebb1037899fd942cc0f52c012f8773505da1", "src": "https://github.com/nvim-telescope/telescope.nvim" }, "tokyonight": { @@ -65,10 +53,6 @@ "rev": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636", "src": "https://github.com/nvim-treesitter/nvim-treesitter-context" }, - "treesitter-playground": { - "rev": "ba48c6a62a280eefb7c85725b0915e021a1a0749", - "src": "https://github.com/nvim-treesitter/playground" - }, "treesitter-textobjects": { "rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e", "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"