aboutsummaryrefslogtreecommitdiff
path: root/lua/pets
diff options
context:
space:
mode:
Diffstat (limited to 'lua/pets')
-rw-r--r--lua/pets/pet.lua18
-rw-r--r--lua/pets/utils.lua9
2 files changed, 10 insertions, 17 deletions
diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua
index 0cdd77b..5f5dbc4 100644
--- a/lua/pets/pet.lua
+++ b/lua/pets/pet.lua
@@ -3,22 +3,6 @@ local M = {}
M.Pet = {}
M.Pet.__index = M.Pet
-local popup_opts = {
- position = {
- row = "100%",
- col = "100%",
- },
- size = {
- width = "30%",
- height = 10,
- },
- focusable = false,
- enter = false,
- win_options = {
- winblend = 100,
- },
-}
-
-- @param name the actual name for the pet
-- @param type the species of the pet e.g. cat
-- @param style the color/style of the pet e.g. brown
@@ -34,7 +18,7 @@ function M.Pet.new(name, type, style, user_opts)
local wd = debug.getinfo(1).source:sub(2):match("(.*nvim/)") .. "media/"
instance.sourcedir = wd .. type .. "/" .. style .. "/"
- instance.popup = require("nui.popup")(popup_opts)
+ instance.popup = require("nui.popup")(user_opts.popup)
instance.animation =
require("pets.animations").Animation.new(instance.sourcedir, type, style, instance.popup, user_opts)
return instance
diff --git a/lua/pets/utils.lua b/lua/pets/utils.lua
index 90f933d..dbf1191 100644
--- a/lua/pets/utils.lua
+++ b/lua/pets/utils.lua
@@ -79,4 +79,13 @@ function M.warning(msg)
vim.notify(msg, vim.log.levels.WARN)
end
+function M.parse_popup_hl(highlight)
+ return table.concat(
+ vim.tbl_map(function(key)
+ return key .. ":" .. highlight[key]
+ end, vim.tbl_keys(highlight)),
+ ","
+ )
+end
+
return M