From 6f664a27bdeaebbf2e4a7e89866dc242762212df Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 1 Mar 2026 12:29:33 -0500 Subject: [PATCH] feat(nvim): lazy-load --- config/nvim/init.lua | 2 +- config/nvim/lua/plugins/cmp.lua | 12 ++++++------ config/nvim/lua/plugins/dev.lua | 24 ++++++++++++++---------- config/nvim/lua/plugins/fzf.lua | 2 +- config/nvim/lua/plugins/git.lua | 2 +- config/nvim/lua/plugins/guard.lua | 4 ++-- config/nvim/lua/plugins/lsp.lua | 4 ++-- config/nvim/lua/plugins/nvim.lua | 20 ++++++++++---------- config/nvim/lua/plugins/treesitter.lua | 2 +- 9 files changed, 38 insertions(+), 34 deletions(-) diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 9102e8c..a037c45 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -2,7 +2,7 @@ vim.g.mapleader = ' ' vim.g.lz_n = { load = function(name) - vim.cmd('packadd! ' .. name) + vim.cmd('packadd! ' .. (name:match('[^/]+$') or name)) end, } diff --git a/config/nvim/lua/plugins/cmp.lua b/config/nvim/lua/plugins/cmp.lua index f197f4a..97757f6 100644 --- a/config/nvim/lua/plugins/cmp.lua +++ b/config/nvim/lua/plugins/cmp.lua @@ -1,10 +1,10 @@ vim.pack.add({ - 'https://github.com/saghen/blink.cmp', - 'https://github.com/Kaiser-Yang/blink-cmp-git', - 'https://github.com/bydlw98/blink-cmp-env', - 'https://github.com/barrettruth/blink-cmp-ssh', - 'https://github.com/barrettruth/blink-cmp-tmux', - 'https://github.com/barrettruth/blink-cmp-ghostty', + { src = 'https://github.com/saghen/blink.cmp', load = false }, + { src = 'https://github.com/Kaiser-Yang/blink-cmp-git', load = false }, + { src = 'https://github.com/bydlw98/blink-cmp-env', load = false }, + { src = 'https://github.com/barrettruth/blink-cmp-ssh', load = false }, + { src = 'https://github.com/barrettruth/blink-cmp-tmux', load = false }, + { src = 'https://github.com/barrettruth/blink-cmp-ghostty', load = false }, }) local pack_dir = vim.fn.stdpath('data') .. '/site/pack/core/opt' diff --git a/config/nvim/lua/plugins/dev.lua b/config/nvim/lua/plugins/dev.lua index b3d6f67..82a59b9 100644 --- a/config/nvim/lua/plugins/dev.lua +++ b/config/nvim/lua/plugins/dev.lua @@ -1,11 +1,20 @@ local dev_plugins = { - ['diffs.nvim'] = '~/dev/diffs.nvim', - ['canola.nvim'] = '~/dev/canola.nvim', - ['pending.nvim'] = '~/dev/pending.nvim', + 'midnight.nvim', + 'live-server.nvim', + 'nonicons.nvim', + 'canola.nvim', + 'pending.nvim', + 'cp.nvim', + 'diffs.nvim', } -for _, path in pairs(dev_plugins) do - vim.opt.rtp:prepend(path) +local opt_dir = vim.fn.stdpath('data') .. '/site/pack/dev/opt/' +vim.fn.mkdir(opt_dir, 'p') +for _, name in ipairs(dev_plugins) do + local link = opt_dir .. name + if not vim.uv.fs_lstat(link) then + vim.uv.fs_symlink(vim.fn.expand('~/dev/' .. name), link) + end end local function parse_output(proc) @@ -176,11 +185,6 @@ local function insert_template(buf, lang, platform) return true end -vim.pack.add({ - 'https://github.com/barrettruth/cp.nvim', - 'https://github.com/nvim-tree/nvim-web-devicons', -}) - return { { 'barrettruth/midnight.nvim', diff --git a/config/nvim/lua/plugins/fzf.lua b/config/nvim/lua/plugins/fzf.lua index 3e33872..1b09715 100644 --- a/config/nvim/lua/plugins/fzf.lua +++ b/config/nvim/lua/plugins/fzf.lua @@ -1,5 +1,5 @@ vim.pack.add({ - 'https://github.com/ibhagwan/fzf-lua', + { src = 'https://github.com/ibhagwan/fzf-lua', load = false }, }) return { diff --git a/config/nvim/lua/plugins/git.lua b/config/nvim/lua/plugins/git.lua index a23823d..54cb292 100644 --- a/config/nvim/lua/plugins/git.lua +++ b/config/nvim/lua/plugins/git.lua @@ -1,5 +1,5 @@ vim.pack.add({ - 'https://github.com/tpope/vim-fugitive', + { src = 'https://github.com/tpope/vim-fugitive', load = false }, { src = 'https://github.com/lewis6991/gitsigns.nvim', load = false }, }) diff --git a/config/nvim/lua/plugins/guard.lua b/config/nvim/lua/plugins/guard.lua index 7593a5c..edb6de1 100644 --- a/config/nvim/lua/plugins/guard.lua +++ b/config/nvim/lua/plugins/guard.lua @@ -1,6 +1,6 @@ vim.pack.add({ - 'https://github.com/nvimdev/guard.nvim', - 'https://github.com/nvimdev/guard-collection', + { src = 'https://github.com/nvimdev/guard.nvim', load = false }, + { src = 'https://github.com/nvimdev/guard-collection', load = false }, }) return { diff --git a/config/nvim/lua/plugins/lsp.lua b/config/nvim/lua/plugins/lsp.lua index c521182..2674491 100644 --- a/config/nvim/lua/plugins/lsp.lua +++ b/config/nvim/lua/plugins/lsp.lua @@ -1,7 +1,7 @@ vim.pack.add({ 'https://github.com/neovim/nvim-lspconfig', - 'https://github.com/folke/lazydev.nvim', - 'https://github.com/saecki/live-rename.nvim', + { src = 'https://github.com/folke/lazydev.nvim', load = false }, + { src = 'https://github.com/saecki/live-rename.nvim', load = false }, }) return { diff --git a/config/nvim/lua/plugins/nvim.lua b/config/nvim/lua/plugins/nvim.lua index ac6b4d0..806ac36 100644 --- a/config/nvim/lua/plugins/nvim.lua +++ b/config/nvim/lua/plugins/nvim.lua @@ -1,14 +1,14 @@ vim.pack.add({ - 'https://github.com/echasnovski/mini.ai', - 'https://github.com/monaqa/dial.nvim', - 'https://github.com/catgoose/nvim-colorizer.lua', - 'https://github.com/echasnovski/mini.pairs', - 'https://github.com/echasnovski/mini.misc', - 'https://github.com/nvim-mini/mini.bufremove', - 'https://github.com/tpope/vim-abolish', - 'https://github.com/tpope/vim-sleuth', - 'https://github.com/kylechui/nvim-surround', - 'https://github.com/lervag/vimtex', + { src = 'https://github.com/echasnovski/mini.ai', load = false }, + { src = 'https://github.com/monaqa/dial.nvim', load = false }, + { src = 'https://github.com/catgoose/nvim-colorizer.lua', load = false }, + { src = 'https://github.com/echasnovski/mini.pairs', load = false }, + { src = 'https://github.com/echasnovski/mini.misc', load = false }, + { src = 'https://github.com/nvim-mini/mini.bufremove', load = false }, + { src = 'https://github.com/tpope/vim-abolish', load = false }, + { src = 'https://github.com/tpope/vim-sleuth', load = false }, + { src = 'https://github.com/kylechui/nvim-surround', load = false }, + { src = 'https://github.com/lervag/vimtex', load = false }, }) return { diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua index fd1166c..e2c0065 100644 --- a/config/nvim/lua/plugins/treesitter.lua +++ b/config/nvim/lua/plugins/treesitter.lua @@ -1,7 +1,7 @@ vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter', 'https://github.com/nvim-treesitter/nvim-treesitter-textobjects', - 'https://github.com/Wansmer/treesj', + { src = 'https://github.com/Wansmer/treesj', load = false }, }) vim.api.nvim_create_autocmd('PackChanged', {