fix: duplicate state check in bootstrap

This commit is contained in:
williamhsieh 2022-12-31 01:52:32 +08:00
commit b0582d9891
2 changed files with 4 additions and 8 deletions

View file

@ -38,12 +38,10 @@ You can add the following Lua code to your `init.lua` to bootstrap **lazy.nvim**
```lua ```lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath }) vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release
end end
end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
``` ```

View file

@ -67,12 +67,10 @@ end
function M.bootstrap() function M.bootstrap()
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath }) vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release
end end
end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
end end