vim: enable alternative plugin dev paths in lazy.nvim

I have to keep the local development version of my plugins in different
places depending on the machine. This make that possible.
This commit is contained in:
Fernando Schauenburg 2024-02-16 16:10:48 +01:00
parent ee08716bed
commit 267c01ff9d

View file

@ -15,6 +15,16 @@ local bootstrap = function(path)
return vim.F.npcall(require, 'lazy') return vim.F.npcall(require, 'lazy')
end end
local dev_path = function()
local paths = {
'~/Projects/nvim-plugins',
'~/.local/src',
}
paths = vim.tbl_map(vim.fn.expand, paths)
paths = vim.tbl_filter(vim.loop.fs_stat, paths)
return paths[1]
end
M.setup = function() M.setup = function()
local lazy = bootstrap(vim.fn.stdpath('data') .. '/lazy/lazy.nvim') local lazy = bootstrap(vim.fn.stdpath('data') .. '/lazy/lazy.nvim')
if not lazy then if not lazy then
@ -27,7 +37,7 @@ M.setup = function()
lazy.setup { lazy.setup {
spec = 'fschauen.plugins', spec = 'fschauen.plugins',
dev = { dev = {
path = '~/Projects/nvim-plugins', path = dev_path(),
fallback = true, fallback = true,
}, },
ui = { ui = {