From cbb80fd20504a27e9b81293df2f540d510f56c09 Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Mon, 13 Oct 2025 19:35:50 +0530 Subject: [PATCH] refactor(neovim): Better lazy.nvim setup - Load options & keymaps right before loading lazy - Bring back lazy suggested `disable_plugins` for performance --- common/.config/nvim/init.lua | 6 ++---- common/.config/nvim/lua/core/lazy.lua | 28 +++++++++++++++++---------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/common/.config/nvim/init.lua b/common/.config/nvim/init.lua index 42ca18f..e5fc79d 100644 --- a/common/.config/nvim/init.lua +++ b/common/.config/nvim/init.lua @@ -9,8 +9,6 @@ -- Copy visual section to a line number -> :'<,'>t15 (copies To line 15) -- Load keymaps & options: Order matters -require("config.options") -require("config.keymaps") require("core.lazy") require("core.lsp") require("config.autocmd") @@ -25,6 +23,6 @@ require("config.autocmd") -- Brew: -- tools: lazygit -- lsp: dockerfile-language-server, markdown-toc, markdownlint-cli, marksman, prettier, prettierd, python-lsp-server, --- shellharden, taplo, typescript-language-server, vue-language-server, yaml-language-server, yamlfmt --- Mason: When they aren't found on OS or Brew +-- taplo, typescript-language-server, vue-language-server, yaml-language-server, yamlfmt +-- MasonInstallAll to install the rest (./lua/config/autocmd.lua) -- codelldb, css-lsp, docker-compose-language-service, html-lsp, json-lsp, sqlls diff --git a/common/.config/nvim/lua/core/lazy.lua b/common/.config/nvim/lua/core/lazy.lua index e477a6d..ed53e24 100644 --- a/common/.config/nvim/lua/core/lazy.lua +++ b/common/.config/nvim/lua/core/lazy.lua @@ -1,15 +1,15 @@ -- `:help lazy.nvim.txt` for more info local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", - lazyrepo, + "https://github.com/folke/lazy.nvim.git", lazypath, }) + if vim.v.shell_error ~= 0 then vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, @@ -20,16 +20,24 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then os.exit(1) end end - ----@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) +require("config.options") +require("config.keymaps") + require("lazy").setup({ - change_detection = { - notify = false, - }, - build = { - warn_on_override = true, - }, spec = { { import = "plugins" } }, + checker = { notify = false }, + change_detection = { notify = false }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, })