fix: duplicate state check in bootstrap (#255)

This commit is contained in:
WilliamHsieh 2022-12-31 01:55:36 +08:00 committed by GitHub
parent 8d452e37bb
commit 51fb95e4a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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