NvChad / starter

Starter config for NvChad
The Unlicense
66 stars 255 forks source link

feat: (init.lua) use lazypath from env if available #22

Closed ayoubelmhamdi closed 2 months ago

ayoubelmhamdi commented 2 months ago

this code is from Astrovim config that handle the lazypath, because we use many configs, we not want to redownload/check the plugins versions.

local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end

vim.opt.rtp:prepend(lazypath)

if not pcall(require, "lazy") then
  vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" }}, true, {})
  vim.fn.getchar()
  vim.cmd.quit()
end
siduck commented 2 months ago

imo this removes the simplicity of the init.lua and also you are free to do anything in your init.lua, this repo's just a starting point!

because we use many configs, we not want to redownload/check the plugins versions.

such users must use nvim appname feature

ayoubelmhamdi commented 2 months ago

the usage of NVIM_APPNAME not enough to distinct between the configs, if i try a new config, and it's break my default plugins, it's not a good experience for new user.

the NVIM_APPNAME make people easy to test other plugins and without spent time to configure each tested plugin, i think.

maybe there is another solution:

local lazypath = vim.fn.stdpath "data" .. "/lazynvchad/lazy.nvim"

what do you think @siduck

siduck commented 2 months ago

@ayoubelmhamdi nvimappname is really handy , so we clone configs in different dirs and then make alias out of it image

ayoubelmhamdi commented 2 months ago

image

@siduck the usage of LAZY env variable is to make the lazy not touch the other plugins of other configs

ayoubelmhamdi commented 2 months ago

i am totally wrong, the usage of NVIM_APPNAME=foo nvim, means two things not, one thing as i expected

~/.config/foo/init.lua
~/.local/share/foo/lazy # and other nvim states

especially, i confuse why Astrovim add LAZY, it's not needed at all. but the comment of @dam9000 is explain to me why i am confuse. https://github.com/nvim-lua/kickstart.nvim/issues/885#issuecomment-2080463586

siduck commented 2 months ago

@ayoubelmhamdi please close that issue, you should first try the nvim appname feature...

NVIM_APPNAME="nvchad" nvim expects ~/.config/nvchad and then all nvim data stuff will be at ~/.local/share/nvchad NVIM_APPNAME="astro" nvim expects ~/.config/astro and then all nvim data stuff will be at ~/.local/share/astro