From 167b84d94a0ea1986ae391ccfba162b382b0d33b Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 7 Sep 2024 22:23:26 -0400 Subject: Future-proof lazy.nvim bootstrap --- init.lua | 30 ++---------------------------- lua/core/lazy.lua | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 lua/core/lazy.lua diff --git a/init.lua b/init.lua index 06ef945..ec2907d 100644 --- a/init.lua +++ b/init.lua @@ -4,34 +4,8 @@ -- | | | | | | |_ _| | |_| | (_| | -- |_|_| |_|_|\__(_)_|\__,_|\__,_| -- +-- Load Modules {{{ require("core") require("core.langmap") - --- Lazy Plugins Bootstrap {{{ -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", - "git@github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) -require("lazy").setup({ - { import = "plugins" }, -- i.e. the lua/plugins directory - -- add more subdirectories as needed -}, { - install = { colorscheme = { "no-clown-fiesta" } }, -}, { - checker = { - enabled = true, - notify = false, - }, - change_detection = { - notify = false, - }, -}) +require("core.lazy") -- }}} diff --git a/lua/core/lazy.lua b/lua/core/lazy.lua new file mode 100644 index 0000000..364be6f --- /dev/null +++ b/lua/core/lazy.lua @@ -0,0 +1,40 @@ +-- _ +-- | | __ _ _____ _ +-- | | / _` |_ / | | | +-- | |__| (_| |/ /| |_| | +-- |_____\__,_/___|\__, | +-- |___/ +-- +-- Bootstrap lazy.nvim {{{ +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, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) +-- }}} +-- Configure Lazy {{{ +require("lazy").setup({ + { import = "plugins" }, -- i.e. the lua/plugins directory + -- add more subdirectories as needed +}, { + install = { colorscheme = { "no-clown-fiesta" } }, +}, { + checker = { + enabled = true, + notify = false, + }, + change_detection = { + notify = false, + }, +}) +-- }}} -- cgit v1.2.3