diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 27e9e06..ca1762e 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -1,3 +1,21 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here + +-- https://github.com/LazyVim/LazyVim/issues/2592#issuecomment-1962891151 +vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimAutocmds", + callback = function() + -- vim.notify("I run AFTER the vim.notify in schedule") + if require("lazy.status").has_updates then + require("lazy").update({ show = false }) + end + + -- NOTE: Use vim.schedule when you need to perform an action asynchronously + -- or when you want to defer execution until the event loop is ready. + -- The function is run *before* any lua code above it. + vim.schedule(function() + -- vim.notify("I run before the vim.notify above") + end) + end, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua index 63edce1..eb2851d 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -14,18 +14,3 @@ opt.colorcolumn = "90,100" -- line length guideline opt.showbreak = " ↪ " -- show linebreak with arrow ↪ opt.linebreak = true -- break line on word, not char -- opt.wrap = true -- toggle with uw - -local function augroup(name) - return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true }) -end - --- when available, auto update when vim starts --- as per discussion here: https://github.com/LazyVim/LazyVim/issues/2592#issuecomment-2015093693 -vim.api.nvim_create_autocmd("VimEnter", { - group = augroup("autoupdate"), - callback = function() - if require("lazy.status").has_updates() then - require("lazy").update({ show = true }) - end - end, -}) diff --git a/lua/plugins/editor_mine.lua b/lua/plugins/editor_mine.lua index e98d11d..9f2a709 100644 --- a/lua/plugins/editor_mine.lua +++ b/lua/plugins/editor_mine.lua @@ -59,10 +59,7 @@ return { }, { "rmagatti/goto-preview", - lazy = false, - dependencies = { - "neovim/nvim-lspconfig" - }, + event = "VeryLazy", opts = { default_mappings = true, resizing_mappings = true,