From 2e110cc2efd191b30fee2325f2ce6ea832789795 Mon Sep 17 00:00:00 2001 From: Hawtian Wang Date: Mon, 1 Apr 2024 22:19:30 +0800 Subject: [PATCH] ... --- lua/dotvim/bootstrap.lua | 6 ++++++ lua/dotvim/core/plugin.lua | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/dotvim/bootstrap.lua b/lua/dotvim/bootstrap.lua index 14af2734..59c0cd40 100644 --- a/lua/dotvim/bootstrap.lua +++ b/lua/dotvim/bootstrap.lua @@ -143,6 +143,12 @@ function M.setup() if Utils.nix.is_nix_managed() then lazy_opts.dev = { path = function(plugin) + local name = Core.plugin.guess_name(plugin) + local dev_path = os.getenv("HOME") .. "/Projects/nvim-plugins/" .. name + ---@diagnostic disable-next-line: undefined-field + if vim.uv.fs_stat(dev_path) then + return dev_path + end local pname = Utils.nix.normalize_plugin_pname(plugin) local resolved_path = Utils.nix.resolve_plugin(pname) if resolved_path ~= nil then diff --git a/lua/dotvim/core/plugin.lua b/lua/dotvim/core/plugin.lua index 273dbe83..07f0c4a2 100644 --- a/lua/dotvim/core/plugin.lua +++ b/lua/dotvim/core/plugin.lua @@ -12,7 +12,7 @@ local M = {} ---@param plugin dotvim.core.plugin.PluginOption ---@return string -local function guess_name(plugin) +function M.guess_name(plugin) -- if has '/', use the second part as name if plugin.name ~= nil then return plugin.name @@ -28,7 +28,7 @@ end ---@return dotvim.core.plugin.PluginOption function M.fix_cond(plugin, processed) local in_vscode = not not vim.g.vscode - local name = guess_name(plugin) + local name = M.guess_name(plugin) if processed[name] then return plugin end