From ff83f6d332c93c6f5124dfd7ba08bcebab2099e3 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 21 Dec 2022 00:38:05 +0100 Subject: Replace packer with lazy --- init.lua | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 03e828b..9b3bfb9 100644 --- a/init.lua +++ b/init.lua @@ -1,30 +1,26 @@ -- ensure nvim with essential plugins. -local fn = vim.fn +local data_path = vim.fn.stdpath "data" +local aniseed_path = vim.fn.stdpath "data" .. "/aniseed/aniseed.nvim" +local lazy_path = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" local fmt = string.format -local execute = vim.api.nvim_command -local packer_path = fn.stdpath "data" .. "/site/pack/packer/start" -local sync = false -local function ensure(user, repository) - local path = fmt("%s/%s", packer_path, repository) - if fn.empty(fn.glob(path)) > 0 then - sync = true - execute( - fmt("!git clone --depth 1 https://github.com/%s/%s %s", user, repository, path) - ) - execute(fmt("packadd %s", repository)) +local function ensure(user, plugin, path) + if not vim.loop.fs_stat(path) then + vim.fn.system { + "git", + "clone", + "--filter=blob:none", + "--single-branch", + fmt("https://github.com/%s/%s.git", user, plugin), + path, + } end end -ensure("wbthomason", "packer.nvim") -ensure("Olical", "aniseed") -ensure("lewis6991", "impatient.nvim") - -if sync then - require("packer").sync() -end - -require "impatient" +ensure("folke", "lazy.nvim", lazy_path) +ensure("Olical", "aniseed", aniseed_path) +vim.opt.runtimepath:prepend(lazy_path) +vim.opt.runtimepath:prepend(aniseed_path) vim.g["aniseed#env"] = { module = "init", -- cgit v1.2.3-70-g09d2