/
plugin_manager.lua
91 lines (80 loc) · 1.87 KB
/
plugin_manager.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
local misc_icons = require('font').misc_icons
local M = {}
local function confirm(manager)
return vim.fn.confirm('Install ' .. manager .. ' or Launch Neovim immediately', '&Yes\n&No', 1) == 1
end
local lazy_enabled = false
local function install_lazy(path)
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
path,
})
end
local lazy_init_default_opts = {
lazy_path = vim.fn.stdpath('cache') .. '/lazy/lazy.nvim',
}
M.lazy_init = function(opts)
opts = vim.tbl_deep_extend('force', lazy_init_default_opts, opts or {})
local lazy_path = opts.lazy_path
local installed_lazy = vim.loop.fs_stat(lazy_path)
if installed_lazy then
lazy_enabled = true
vim.opt.rtp:prepend(lazy_path)
elseif confirm('lazy.nvim') then
install_lazy(lazy_path)
lazy_enabled = true
vim.opt.rtp:prepend(lazy_path)
end
end
local lazy_setup_default_opts = {
root = vim.fn.stdpath('cache') .. '/lazy',
defaults = {
lazy = true,
},
concurrency = 100,
install = {
colorscheme = { vim.env.NVIM_COLORSCHEME },
},
checker = {
enable = true,
concurrency = 100,
},
dev = { path = '~/repos/github.com/yuki-yano' },
ui = {
border = 'rounded',
icons = {
lazy = misc_icons.lazy .. ' ',
runtime = misc_icons.vim,
cmd = misc_icons.cmd,
import = misc_icons.file,
ft = misc_icons.folder,
},
},
performance = {
rtp = {
disabled_plugins = {
'gzip',
'matchit',
'matchparen',
'netrwPlugin',
'tarPlugin',
'tohtml',
'tutor',
'zipPlugin',
'spellfile',
'rplugin',
},
},
},
}
M.lazy_setup = function(opts)
if not lazy_enabled then
return
end
opts = vim.tbl_deep_extend('force', lazy_setup_default_opts, opts or {})
require('lazy').setup('plugins', opts)
end
return M