Skip to content

Commit 66c926b

Browse files
committed
docs: fix README
1 parent 2a2e265 commit 66c926b

File tree

2 files changed

+61
-95
lines changed

2 files changed

+61
-95
lines changed

README.md

Lines changed: 60 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
A tiny Neovim plugin that adds subtle animations to various operations.
44

5+
**Do not forget to enable animations on operations you want to animate ! A lot of operations are disabled by default.**
6+
57
![Neovim version](https://img.shields.io/badge/Neovim-0.10+-blueviolet.svg)
68
![License](https://img.shields.io/badge/license-MIT-blue.svg)
79

@@ -21,19 +23,22 @@ https://github.com/user-attachments/assets/6bc98a8f-8b7e-4b57-958a-74ad5372612f
2123

2224
### Undo/Redo support
2325
![tiny_glimmer_demo_undo_redo](https://github.com/user-attachments/assets/6e980884-b425-42d2-a179-6c6126196bd5)
26+
- Smooth animations for various operations:
27+
- Yank and paste
28+
- Search navigation
29+
- Undo/redo operations
30+
- Custom operations support
31+
32+
Built-in animation styles:
33+
- `fade`: Smooth fade in/out transition
34+
- `reverse_fade`: Reverse fade effect with outBack easing
35+
- `bounce`: Bouncing highlight effect
36+
- `left_to_right`: Linear left-to-right sweep
37+
- `pulse`: Pulsating highlight
38+
- `rainbow`: Rainbow color transition
39+
- `custom`: Define your own animation logic
2440

2541

26-
27-
- Smooth animations for yank operations
28-
- Multiple animation styles:
29-
- `fade`: Simple fade in/out effect
30-
- `reverse_fade`: Reverse fade in/out effect
31-
- `bounce`: Bouncing transition
32-
- `left_to_right`: Linear left-to-right animation
33-
- `pulse`: Pulsating highlight effect
34-
- `rainbow`: Rainbow transition
35-
- `custom`: Custom animation that you can define
36-
3742
## 📋 Requirements
3843

3944
- Neovim >= 0.10
@@ -71,13 +76,13 @@ require('tiny-glimmer').setup({
7176
-- Disable this if you wants to debug highlighting issues
7277
disable_warnings = true,
7378

74-
refresh_interval_ms = 6,
79+
refresh_interval_ms = 8,
7580

7681
overwrite = {
7782
-- Automatically map keys to overwrite operations
7883
-- If set to false, you will need to call the API functions to trigger the animations
7984
-- WARN: You should disable this if you have already mapped these keys
80-
-- or if you want to use the API functions to trigger the animations
85+
-- or if you want to use the API functions to trigger the animations
8186
auto_map = true,
8287

8388
-- For search and paste, you can easily modify the animation to suit your needs
@@ -97,14 +102,18 @@ require('tiny-glimmer').setup({
97102
--
98103
-- All "mapping" can be set in 2 ways:
99104
-- 1. A string with the key you want to map
100-
-- Example:
101-
-- paste_mapping = "p"
105+
-- Example:
106+
-- paste_mapping = "p"
102107
-- 2. A table with the key you want to map and its actions
103-
-- Example:
104-
-- paste_mapping = {
105-
-- lhs = "p"
106-
-- rhs = "<Plug>(YankyPutAfter)"
107-
-- }
108+
-- Example:
109+
-- paste_mapping = {
110+
-- lhs = "p"
111+
-- rhs = "<Plug>(YankyPutAfter)"
112+
-- }
113+
yank = {
114+
enabled = true,
115+
default_animation = "fade",
116+
},
108117
search = {
109118
enabled = false,
110119
default_animation = "pulse",
@@ -115,12 +124,8 @@ require('tiny-glimmer').setup({
115124
-- Keys to navigate to the previous match
116125
prev_mapping = "Nzzzv",
117126
},
118-
yank = {
119-
enabled = true,
120-
default_animation = "fade",
121-
},
122127
paste = {
123-
enabled = false,
128+
enabled = true,
124129
default_animation = "reverse_fade",
125130

126131
-- Keys to paste
@@ -162,7 +167,6 @@ require('tiny-glimmer').setup({
162167
},
163168
},
164169

165-
166170
support = {
167171
-- Enable support for gbprod/substitute.nvim
168172
-- You can use it like so:
@@ -180,7 +184,6 @@ require('tiny-glimmer').setup({
180184
},
181185
},
182186

183-
184187
-- Animations for other operations
185188
presets = {
186189
-- Enable animation on cursorline when an event in `on_events` is triggered
@@ -205,41 +208,57 @@ require('tiny-glimmer').setup({
205208
-- Only use if you have a transparent background
206209
-- It will override the highlight group background color for `to_color` in all animations
207210
transparency_color = nil,
211+
-- Animation configurations
208212
animations = {
209213
fade = {
210214
max_duration = 400,
211215
min_duration = 300,
212216
easing = "outQuad",
213217
chars_for_max_duration = 10,
218+
from_color = "Visual", -- Highlight group or hex color
219+
to_color = "Normal", -- Same as above
214220
},
215221
reverse_fade = {
216222
max_duration = 380,
217223
min_duration = 300,
218224
easing = "outBack",
219225
chars_for_max_duration = 10,
226+
from_color = "Visual",
227+
to_color = "Normal",
220228
},
221229
bounce = {
222230
max_duration = 500,
223231
min_duration = 400,
224232
chars_for_max_duration = 20,
225233
oscillation_count = 1,
234+
from_color = "Visual",
235+
to_color = "Normal",
226236
},
227237
left_to_right = {
228238
max_duration = 350,
229239
min_duration = 350,
230240
min_progress = 0.85,
231241
chars_for_max_duration = 25,
232242
lingering_time = 50,
243+
from_color = "Visual",
244+
to_color = "Normal",
233245
},
234246
pulse = {
235247
max_duration = 600,
236248
min_duration = 400,
237249
chars_for_max_duration = 15,
238250
pulse_count = 2,
239251
intensity = 1.2,
252+
from_color = "Visual",
253+
to_color = "Normal",
254+
},
255+
rainbow = {
256+
max_duration = 600,
257+
min_duration = 350,
258+
chars_for_max_duration = 20,
240259
},
241260

242-
-- You can add as many animations as you want
261+
-- You can add as many animations as you want
243262
custom = {
244263
-- You can also add as many custom options as you want
245264
-- Only `max_duration` and `chars_for_max_duration` is required
@@ -351,25 +370,14 @@ Each animation type has its own configuration options:
351370

352371
- `:TinyGlimmer enable` - Enable animations
353372
- `:TinyGlimmer disable` - Disable animations
354-
- `:TinyGlimmer fade` - Switch to fade animation
355-
- `:TinyGlimmer reverse_fade` - Switch to reverse fade animation
356-
- `:TinyGlimmer bounce` - Switch to bounce animation
357-
- `:TinyGlimmer left_to_right` - Switch to left-to-right animation
358-
- `:TinyGlimmer pulse` - Switch to pulse animation
359-
- `:TinyGlimmer rainbow` - Switch to rainbow animation
360-
- `:TinyGlimmer custom` - Switch to your custom animation
373+
- `:TinyGlimmer <animation>` - Switch animation style
374+
- Supported: fade, reverse_fade, bounce, left_to_right, pulse, rainbow, custom
361375

362376
## 🛠️ API
363-
364377
```lua
365-
-- Enable animations
366-
require('tiny-glimmer').enable()
367-
368-
-- Disable animations
369-
require('tiny-glimmer').disable()
370-
371-
-- Toggle animations
372-
require('tiny-glimmer').toggle()
378+
require('tiny-glimmer').enable() -- Enable animations
379+
require('tiny-glimmer').disable() -- Disable animations
380+
require('tiny-glimmer').toggle() -- Toggle animations
373381

374382
--- Change highlight
375383
--- @param animation_name string|string[] The animation name. Can be a string or a table of strings.
@@ -391,66 +399,24 @@ require('tiny-glimmer').search_under_cursor() -- Same as `*`
391399
-- When overwrite.paste.enabled is true
392400
require('tiny-glimmer').paste() -- Same as `p`
393401
require('tiny-glimmer').Paste() -- Same as `P`
394-
```
395402

396-
### Keymaps
397-
> [!INFO]
398-
> If you have `overwrite.auto_map` set to `true`, you don't need to set these keymaps.
399-
400-
Configuration example with overwrites enabled:
401-
```lua
402-
{
403-
"rachartier/tiny-glimmer.nvim",
404-
event = "VeryLazy",
405-
keys = {
406-
{
407-
"n",
408-
function()
409-
require("tiny-glimmer").search_next()
410-
end,
411-
{ noremap = true, silent = true },
412-
},
413-
{
414-
"N",
415-
function()
416-
require("tiny-glimmer").search_prev()
417-
end,
418-
{ noremap = true, silent = true },
419-
},
420-
{
421-
"p",
422-
function()
423-
require("tiny-glimmer").paste()
424-
end,
425-
{ noremap = true, silent = true },
426-
},
427-
{
428-
"P",
429-
function()
430-
require("tiny-glimmer").Paste()
431-
end,
432-
{ noremap = true, silent = true },
433-
},
434-
{
435-
"*",
436-
function()
437-
require("tiny-glimmer").search_under_cursor()
438-
end,
439-
{ noremap = true, silent = true },
440-
}
441-
},
442-
opts = {},
443-
}
403+
-- Undo operations (requires undo.enabled = true)
404+
require('tiny-glimmer').undo() -- Undo changes
405+
require('tiny-glimmer').redo() -- Redo changes
444406
```
407+
445408
## ❓FAQ
446409

447410
### Why is there two animations playing at the same time?
448411
You should disable your own `TextYankPost` autocmd that calls `vim.highlight.on_yank`
449412

413+
### Transparent background issues?
414+
Set the `transparency_color` option to your desired background color.
450415

451416
## Thanks
452417

453-
- [EmmanuelOga/easing](https://github.com/EmmanuelOga) for the easing functions
418+
- [EmmanuelOga/easing](https://github.com/EmmanuelOga) - Easing function implementations
419+
- [tzachar/highlight-undo.nvim](https://github.com/tzachar/highlight-undo.nvim) - Inspiration for hijack function
454420

455421
## 📝 License
456422

lua/tiny-glimmer/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ M.config = {
102102
},
103103
},
104104

105-
refresh_interval_ms = 6,
105+
refresh_interval_ms = 8,
106106
transparency_color = nil,
107107

108108
animations = {

0 commit comments

Comments
 (0)