diff options
| author | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-16 14:03:55 +0100 |
|---|---|---|
| committer | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-16 14:13:49 +0100 |
| commit | c8a5c2dfd256b780a30f37d69cfe9c407db4bf5e (patch) | |
| tree | 75f0006d5d87473b4d10fd325e66be006c97632a /lua/pets | |
| parent | chore: merge dev (diff) | |
feat(popup): popup options / hopefully fix black square
Diffstat (limited to 'lua/pets')
| -rw-r--r-- | lua/pets/pet.lua | 18 | ||||
| -rw-r--r-- | lua/pets/utils.lua | 9 |
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 |