feat: add flexible package manager detection in pigeon setup

This commit is contained in:
2024-08-31 16:41:44 -04:00
parent d8cf018277
commit 1fe385f572
2 changed files with 39 additions and 0 deletions
+35
View File
@@ -280,6 +280,41 @@ M.plugin_reloader = {
},
}
M.pigeon = function()
local data = require("data")
local platform = data.func.get_os("platform")
local lazy_installed = pcall(require, "lazy")
local packer_installed = pcall(require, "packer_plugins")
local pigeon_enabled = true -- default
local plugman = "lazy" -- default package manager
if lazy_installed then
plugman = "lazy"
elseif packer_installed then
plugman = "packer"
elseif vim.fn.exists("g:plugs") == 1 then
plugman = "vim-plug"
else
data.func.notify(
"Failed to detect package manager.\nPigeon disabled.",
"ERROR"
)
pigeon_enabled = false
return
end
local config = {
enabled = pigeon_enabled,
os = platform,
plugin_manager = plugman,
callbacks = {
killing_pigeon = nil,
respawning_pigeon = nil,
},
-- more config options here
}
require("pigeon").setup(config)
end
M.substitute = {
yank_substituted_text = false,
preserve_cursor_position = true,