plug(Lazy): specify developer plugin folder path in custom file in each machine
[edyt.git] / lua / core / lazy.lua
blob4e99c2c7b659e648d58b49810b42a7dd00687f59
1 -- Bootstrap lazy --<--
2 local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
3 -- If not installed get lazy.nvim
4 if not vim.loop.fs_stat(lazypath) then
5 vim.fn.system({
6 "git",
7 "clone",
8 "--filter=blob:none",
9 "https://github.com/folke/lazy.nvim.git",
10 "--branch=stable", -- latest stable release
11 lazypath,
13 end
14 local dev_path_file = vim.fn.stdpath("config") .. "/lua/plugins/dev_path.txt"
15 -- Check if the file with custom dev plugins folder path exists
16 if vim.fn.filereadable(dev_path_file) ~= 1 then
17 -- File doesn't exist, ask the user for a path
18 local desired_path = vim.fn.input("Enter the path for custom neovim plugins: ", dev_path_file)
19 -- Ask for confirmation before writing to the file
20 local confirm = vim.fn.confirm(
21 "Save the path '" .. desired_path .. "' to " .. dev_path_file .. "?",
22 "&Yes\n&No",
25 if confirm == 1 then
26 -- Write the user's input to the file
27 vim.fn.writefile({ desired_path }, dev_path_file)
28 else
29 print("Plugin path not saved. Using fallback path.")
30 end
31 end
32 local dev_path = vim.fn.trim(vim.fn.readfile(dev_path_file)[1])
34 vim.opt.rtp:prepend(lazypath)
35 local lazy = Prequire("lazy")
36 if not lazy then return end
37 -->--
39 lazy.setup("plugins", {
40 defaults = { lazy = true },
41 lockfile = vim.fn.stdpath("config") .. "/.lazy-lock.json",
42 git = { log = { "-5" } }, -- Show the last 5 commits
43 dev = { path = dev_path or "~/projects", fallback = true },
44 ui = { border = "rounded" },
45 install = {
46 colorscheme = { "rose-pine", "habamax" },
48 change_detection = { notify = false },
49 checker = { enabled = true },
50 performance = {
51 rtp = {
52 disabled_plugins = { --<--
53 "editorconfig",
54 "gzip",
55 "matchit",
56 "matchparen",
57 "rplugin",
58 "tarPlugin",
59 "tohtml",
60 "tutor",
61 "zipPlugin",
62 "spellfile",
63 }, -->--
68 local lazymap = MAP("LAZY")
69 lazymap.nmap("<leader>ll", lazy.home, "open [l]azy.nvim")
70 lazymap.nmap("<leader>lp", lazy.profile, "[l]azy [p]rofile")
71 lazymap.nmap("<leader>lu", lazy.update, "[l]azy [u]update")