aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Gadola <giusgadola@gmail.com>2023-02-15 13:21:16 +0100
committerGiuseppe Gadola <giusgadola@gmail.com>2023-02-15 13:21:16 +0100
commit5d248d46f220db79be5c5cfdc29a6167766cee64 (patch)
tree47dc694a59cbab44502a408beae07951fb81f6f1
parentfix(commands): fixed pets list (diff)
chore: validate row option
-rw-r--r--README.md7
-rw-r--r--lua/pets/pet.lua4
2 files changed, 6 insertions, 5 deletions
diff --git a/README.md b/README.md
index 1c52cb5..c01a63b 100644
--- a/README.md
+++ b/README.md
@@ -29,10 +29,6 @@ With lazy:
{
"giusgad/pets.nvim",
dependencies = { "MunifTanjim/nui.nvim", "edluffy/hologram.nvim" },
- config = true,
- opts = {
- -- your options
- }
}
```
@@ -41,7 +37,7 @@ With lazy:
This is the default configuration:
```lua
{
- row = 5, -- the row (height) to display the pet at
+ row = 5, -- the row (height) to display the pet at (must be at least 1)
col = 0, -- the column to display the pet at (set to high number to have it stay still on the right side)
speed_multiplier = 1, -- you can make your pet move faster/slower. If slower the animation will have lower fps.
default_pet = "cat", -- the pet to use for the PetNew command
@@ -82,6 +78,7 @@ and shares all of its limitations. Here are the most significant ones:
## ✔️ Roadmap
- [ ] Handle window resizes
- [ ] add more pets
+- [ ] add an option to change the pet's size
## 👏 Credits
diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua
index 2442eec..f045f70 100644
--- a/lua/pets/pet.lua
+++ b/lua/pets/pet.lua
@@ -42,6 +42,10 @@ end
-- start the animation of the pet
function M.Pet:animate()
+ if self.animation.row <= 0 then
+ vim.notify("Row must be 1 or greater. Check your config", vim.log.levels.ERROR)
+ return
+ end
self.popup:mount()
self.animation:start()
end