From 7038f9145e8d16e37a1bc43f30bf74a89f6d450a Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Fri, 22 Mar 2024 13:02:23 -0500 Subject: [PATCH] chg: Switch to lazy.nvim for plugins --- .gitignore | 3 +++ laptop/init.lua | 2 +- laptop/plugins.lua | 42 ++++++++++++++++-------------------------- server/init.lua | 2 +- server/plugins.lua | 42 +++++++++++++++++------------------------- vps/init.lua | 2 +- vps/plugins.lua | 42 +++++++++++++++++------------------------- 7 files changed, 56 insertions(+), 79 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2548715 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore lazy-lock files +lazy-lock.json + diff --git a/laptop/init.lua b/laptop/init.lua index 9fb9328..4a2ab50 100644 --- a/laptop/init.lua +++ b/laptop/init.lua @@ -3,7 +3,7 @@ package.path = package.path .. ';' .. vim.fn.stdpath("config") .. "/?.lua" -- Load global configs require("globals") --- Load plugins using paq-nvim +-- Load plugins using lazy.nvim require("plugins") -- Load keymaps require("keymaps") diff --git a/laptop/plugins.lua b/laptop/plugins.lua index d05c620..3317c2c 100644 --- a/laptop/plugins.lua +++ b/laptop/plugins.lua @@ -1,29 +1,19 @@ --- Automatically bootstrap paq-nvim -local function clone_paq() - local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim" - local is_installed = vim.fn.empty(vim.fn.glob(path)) == 0 - if not is_installed then - vim.fn.system { "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", path } - return true - end -end - --- Automatically install new packages at startup -local function bootstrap_paq(packages) - local first_install = clone_paq() - vim.cmd.packadd("paq-nvim") - local paq = require("paq") - paq(packages) - if first_install then - vim.notify("Installing plugins... If prompted, hit Enter to continue.") - paq.install() - end +-- Automatically bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end +vim.opt.rtp:prepend(lazypath) -- Load plugin via paq-nvim -bootstrap_paq { - -- Let paq-nvim manage itself - "savq/paq-nvim", +require("lazy").setup({ -- Use lualine for statusbar "nvim-lualine/lualine.nvim", "nvim-tree/nvim-web-devicons", @@ -46,9 +36,9 @@ bootstrap_paq { "hrsh7th/cmp-cmdline", "SirVer/ultisnips", -- For snippets -- Support programming terms - { "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' }, + { "psliwka/vim-dirtytalk", build = ":DirtytalkUpdate" }, -- vim-moonfly theme - { "bluz71/vim-moonfly-colors", as = 'moonfly' }, + { "bluz71/vim-moonfly-colors", as = "moonfly" }, -- Rust tools "simrat39/rust-tools.nvim", -- Automatically add bracket pairs @@ -61,5 +51,5 @@ bootstrap_paq { "stevearc/conform.nvim", "junegunn/fzf.vim", "kylechui/nvim-surround", -} +}) diff --git a/server/init.lua b/server/init.lua index 9fb9328..4a2ab50 100644 --- a/server/init.lua +++ b/server/init.lua @@ -3,7 +3,7 @@ package.path = package.path .. ';' .. vim.fn.stdpath("config") .. "/?.lua" -- Load global configs require("globals") --- Load plugins using paq-nvim +-- Load plugins using lazy.nvim require("plugins") -- Load keymaps require("keymaps") diff --git a/server/plugins.lua b/server/plugins.lua index 7e460c1..447f2ee 100644 --- a/server/plugins.lua +++ b/server/plugins.lua @@ -1,27 +1,19 @@ --- Automatically bootstrap paq-nvim -local function clone_paq() - local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim" - local is_installed = vim.fn.empty(vim.fn.glob(path)) == 0 - if not is_installed then - vim.fn.system { "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", path } - return true - end +-- Automatically bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end +vim.opt.rtp:prepend(lazypath) --- Automatically install new packages at startup -local function bootstrap_paq(packages) - local first_install = clone_paq() - vim.cmd.packadd("paq-nvim") - local paq = require("paq") - paq(packages) - if first_install then - vim.notify("Installing plugins... If prompted, hit Enter to continue.") - paq.install() - end -end - --- Load plugins via paq-nvim -bootstrap_paq { +-- Load plugins via lazy.nvim +require("lazy").setup({ -- Let paq-nvim manage itself "savq/paq-nvim", -- Use lualine for statusbar @@ -41,9 +33,9 @@ bootstrap_paq { "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", -- Support programming terms - { "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' }, + { "psliwka/vim-dirtytalk", build = ":DirtytalkUpdate" }, -- vim-moonfly theme - { "bluz71/vim-moonfly-colors", as = 'moonfly' }, + { "bluz71/vim-moonfly-colors", as = "moonfly" }, -- Automatically add bracket pairs "windwp/nvim-autopairs", -- Syntax highlighting for Caddyfile @@ -53,5 +45,5 @@ bootstrap_paq { "kylechui/nvim-surround", "junegunn/fzf", "junegunn/fzf.vim", -} +}) diff --git a/vps/init.lua b/vps/init.lua index 9fb9328..4a2ab50 100644 --- a/vps/init.lua +++ b/vps/init.lua @@ -3,7 +3,7 @@ package.path = package.path .. ';' .. vim.fn.stdpath("config") .. "/?.lua" -- Load global configs require("globals") --- Load plugins using paq-nvim +-- Load plugins using lazy.nvim require("plugins") -- Load keymaps require("keymaps") diff --git a/vps/plugins.lua b/vps/plugins.lua index c42e1a6..4a93bb5 100644 --- a/vps/plugins.lua +++ b/vps/plugins.lua @@ -1,27 +1,19 @@ --- Automatically bootstrap paq-nvim -local function clone_paq() - local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim" - local is_installed = vim.fn.empty(vim.fn.glob(path)) == 0 - if not is_installed then - vim.fn.system { "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", path } - return true - end +-- Automatically bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end +vim.opt.rtp:prepend(lazypath) --- Automatically install new packages at startup -local function bootstrap_paq(packages) - local first_install = clone_paq() - vim.cmd.packadd("paq-nvim") - local paq = require("paq") - paq(packages) - if first_install then - vim.notify("Installing plugins... If prompted, hit Enter to continue.") - paq.install() - end -end - --- Load plugins via paq-nvim -bootstrap_paq { +-- Load plugins via lazy.nvim +require("lazy").setup({ -- Let paq-nvim manage itself "savq/paq-nvim", -- Use lualine for statusbar @@ -41,9 +33,9 @@ bootstrap_paq { "hrsh7th/cmp-path", "hrsh7th/cmp-cmdline", -- Support programming terms - { "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' }, + { "psliwka/vim-dirtytalk", build = ":DirtytalkUpdate" }, -- vim-moonfly theme - { "bluz71/vim-moonfly-colors", as = 'moonfly' }, + { "bluz71/vim-moonfly-colors", as = "moonfly" }, -- Automatically add bracket pairs "windwp/nvim-autopairs", -- Syntax highlighting for Caddyfile @@ -53,5 +45,5 @@ bootstrap_paq { "kylechui/nvim-surround", "junegunn/fzf", "junegunn/fzf.vim", -} +})