Features
One-shot Timers
This release introduces one-shot timers; timers which go off a single time and the delete themselves.
These timers can be created by using the :PulseSetTimer <name> <interval>
user command, or by adding a timer using pulse.add
with the one_shot option set to true:
pulse.add("one-shot-timer", { one_shot = true })
New pulse.add()
API
This PR also introduces a new API for adding timers. The previous API required users to remember the order of parameters and provide them all (no defaults were available). The new API only requires that the timer has a name, and provides sensible defaults for all other parameters.
The new API format and its defaults can be found in :h pulse.add()
User-defined Callbacks
The new API also allows users to define their own callbacks to be executed when their timer goes off. The default callback remains as using vim.notify
to display the timer message. Users can now integrate pulse
with nvim-notify
if they so wish!
The callback takes a single parameter, timer
, which is the reference to the timer itself. This allows users to manipulate the timer how they please through their callback.
Multi-select timers in commands
This PR adds the capacity to multi-select timers when using the :PulseEnable
and :PulseStatus
commands. This way, users can disable and enable multiple timers at once.
Command auto-complete
The following commands now have auto complete suggestions for arguments (timer names):
:PulseEnable
:PulseDisable
:PulseStatus
Bug fixes
PulseStatus
returns the remaining time on the timer instead of just the repeat intervalpulse.enable
andpulse.disable
no longer throw errors when used