NArea - Notification Area
Table of Contents
NArea
NArea (yalms.ui.narea) provides a lightweight notification area in a floating Neovim window. It uses Snacks.win for rendering and displays notifications as virtual text with configurable icons for different notification types.
Prerequisites
- Snacks.nvim must be installed.
Usage
Setup
NArea is typically created programmatically:
local NArea = require('yalms.ui.narea')
local narea = NArea:new({
kinds = {
Info = "",
Warning = "",
Error = "",
},
auto_dismiss = 3000, -- auto-dismiss after 3 seconds
})
Sending Notifications
Send a structured notification:
narea:emit("notification", {
type = "Info",
text = "Operation completed successfully",
dismiss = 2500, -- override auto_dismiss for this notification
})
Or send raw virtual text:
narea:emit("n", {
{ " Info ", "Bold" },
{ " Operation completed", "@text" },
})
Controlling the Window
narea:show() -- show the notification area narea:hide() -- hide the notification area narea:dismiss() -- dismiss current notification and hide narea:close() -- close and cleanup the narea instance
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
kinds |
table<string, string> |
Info/Warning/Error icons | Notification type to icon mapping |
win |
snacks.win.Config |
see below | Snacks window configuration |
auto_dismiss |
integer? |
nil | Auto-dismiss timeout in ms (nil = no auto-dismiss) |
Default Window Configuration
The NArea window defaults to:
- Floating window with no border
- Title: "NArea"
- Auto-sized to content