From 38ac86c63057044211d9ed765b84ad2a35814335 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Sat, 22 Feb 2025 15:06:31 +0000 Subject: [PATCH] lazyvim: replace LazyFile with their actual events LazyFile is a custom event in LazyVim that simple wraps the BufReadPost, BufNewFile and BufWritePre events. Let's just be explicit and use them directly. --- nvim/lua/plugins/editor.lua | 4 ++-- nvim/lua/plugins/lint.lua | 2 +- nvim/lua/plugins/lsp/init.lua | 2 +- nvim/lua/plugins/treesitter.lua | 4 ++-- nvim/lua/plugins/ui.lua | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nvim/lua/plugins/editor.lua b/nvim/lua/plugins/editor.lua index 5dcdccf..b8bd5aa 100644 --- a/nvim/lua/plugins/editor.lua +++ b/nvim/lua/plugins/editor.lua @@ -73,7 +73,7 @@ return { -- Finds and lists all of the TODO, HACK, BUG, etc comment -- in your project and loads them into a browsable list. cmd = { "TodoTrouble"}, - event = "LazyFile", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, -- stylua: ignore keys = { { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" }, @@ -104,7 +104,7 @@ return { -- git signs highlights text that has changed since the list -- git commit, and also lets you interactively stage & unstage -- hunks in a commit. - event = "LazyFile", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, opts = { signs = { add = { text = "▎" }, diff --git a/nvim/lua/plugins/lint.lua b/nvim/lua/plugins/lint.lua index de4c4f2..0184577 100644 --- a/nvim/lua/plugins/lint.lua +++ b/nvim/lua/plugins/lint.lua @@ -2,7 +2,7 @@ local M = {} return { { "mfussenegger/nvim-lint", - event = "LazyFile", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, opts = { -- Event to trigger linters events = { "BufWritePost", "BufReadPost", "InsertLeave" }, diff --git a/nvim/lua/plugins/lsp/init.lua b/nvim/lua/plugins/lsp/init.lua index af50c8c..132c412 100644 --- a/nvim/lua/plugins/lsp/init.lua +++ b/nvim/lua/plugins/lsp/init.lua @@ -1,6 +1,6 @@ return { { "neovim/nvim-lspconfig", - event = "LazyFile", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, dependencies = { "mason.nvim", { "williamboman/mason-lspconfig.nvim", config = function() end }, -- don't configure yet diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index f58f6ae..5ffa798 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -2,7 +2,7 @@ return { { "nvim-treesitter/nvim-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" }, build = ":TSUpdate", - event = { "LazyFile", "VeryLazy" }, + event = { "BufReadPost", "BufNewFile", "BufWritePre" , "VeryLazy" }, 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 @@ -106,7 +106,7 @@ return { -- Automatically add closing tags for HTML and JSX { "windwp/nvim-ts-autotag", - event = "LazyFile", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, opts = {}, }, } diff --git a/nvim/lua/plugins/ui.lua b/nvim/lua/plugins/ui.lua index 261312a..8e52958 100644 --- a/nvim/lua/plugins/ui.lua +++ b/nvim/lua/plugins/ui.lua @@ -317,7 +317,7 @@ return { { "echasnovski/mini.indentscope", enabled = false, -- replaced by snacks.indent version = false, -- wait till new 0.7.0 release to put it back on semver - event = "LazyFile", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, opts = function (_, opts) return { draw = { -- 2.48.1