vim: move lazy config to its own file

This commit is contained in:
Fernando Schauenburg 2023-08-06 19:48:11 +02:00
parent b4056586a2
commit fc731f1d63
2 changed files with 30 additions and 20 deletions

View file

@ -6,24 +6,5 @@ require 'user.options'
require 'user.keymap' require 'user.keymap'
require 'user.autocmds' require 'user.autocmds'
require 'user.filetypes' require 'user.filetypes'
require 'user.lazy'
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",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup('user.plugins', {
dev = {
path = '~/Projects/nvim-plugins',
fallback = true,
},
})

View file

@ -0,0 +1,29 @@
local get_lazy = function()
local path = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(path) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'--branch=stable',
'https://github.com/folke/lazy.nvim.git',
path,
}
end
vim.opt.rtp:prepend(path)
local _, lazy = pcall(require, 'lazy')
return lazy
end
local lazy = get_lazy()
if lazy then
lazy.setup('user.plugins', {
dev = {
path = '~/Projects/nvim-plugins',
fallback = true,
},
})
else
vim.notify('Lazy not installed and failed to bootstrap!', vim.log.levels.ERROR)
end