A small Neovim plugin that schedules reminder popups at specific times of day (HH:MM).
This plugin depends on aelisonCode/modal_reminder.nvim to display the centered reminder popup.
- Schedule reminders at specific times (e.g.
08:30,13:30) - One message for all times, or one message per time
- Start / stop / status
- Runtime commands to add/remove/list timers (no need to edit plugin config)
- Persistence (JSON) so timers can survive restarting Neovim
- Optional default keymaps (can be disabled so you set your own)
return {
"aelisonCode/modal_timer.nvim",
dependencies = {
"aelisonCode/modal_reminder.nvim",
},
opts = {
autostart = true, -- Let the plugin start when launching nvim
times = { "09:20" },
messages = { "Hey, time to take a break!" },
keymaps = {
enabled = true,
start = "<leader>ts",
stop = "<leader>te",
status = "<leader>tc",
},
},
config = function(_, opts)
require("modal_timer").setup(opts)
end,
}List of times in 24h format:
times = { "08:30", "13:30", "17:00" }- If
messageshas 1 entry: it is used for all times. - If
messageshas the same length astimes: the message at indexiis used fortimes[i].
Examples:
messages = { "Take a break!" }times = { "09:00", "13:30" }
messages = { "Morning break", "Lunch break" }Default keymaps are optional:
keymaps = {
enabled = true,
start = "<leader>ts",
stop = "<leader>te",
status = "<leader>tc",
}Disable default mappings if you prefer to set your own:
keymaps = { enabled = false }Then define your own:
vim.keymap.set("n", "<leader>ts", require("modal_timer").start)
vim.keymap.set("n", "<leader>te", require("modal_timer").stop)
vim.keymap.set("n", "<leader>tc", require("modal_timer").status)You can manage timers at runtime (no need to edit your plugin config):
-
:AddTimer HH:MM {message...}
Adds a timer atHH:MM. If the time already exists, it updates the message.Examples:
:AddTimer 15:00 Time to take a break:AddTimer 09:30 Stand up and stretch
-
:RemoveTimer HH:MM
Removes a timer by its time.:RemoveTimer 15:00
-
:ListTimers
Lists all configured timers and messages. -
:ClearTimers
Clears all configured timers and stops the scheduler.
require("modal_timer").start()
require("modal_timer").stop()
require("modal_timer").status()Timers added/removed via commands are saved to a JSON file so they can survive restarting Neovim.
The file is located at:
stdpath("data") .. "/modal_timer.json"
Common locations:
- Linux:
~/.local/share/nvim/modal_timer.json - macOS:
~/.local/share/nvim/modal_timer.json - Windows:
%LOCALAPPDATA%\\nvim-data\\modal_timer.json
To print the exact path on your machine:
:lua print(vim.fn.stdpath("data") .. "/modal_timer.json")To reset everything, you can either run :ClearTimers or delete that JSON file manually.
This plugin schedules reminders for the current day only:
- If a configured time has already passed today, it will be skipped (it will not roll over to tomorrow).
- When there are no more times remaining today, the timer stops and shows a message.
- Times must be in
HH:MMformat. - Reminders are scheduled using a one-shot libuv timer and re-armed after each trigger.
- Persistence stores only the configured
timesandmessages(it does not log history), so the JSON file will not grow over time.