-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
nvim-notify.txt
228 lines (180 loc) · 8.32 KB
/
nvim-notify.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
*nvim-notify.txt* A fancy, configurable notification manager for NeoVim
==============================================================================
A fancy, configurable notification manager for NeoVim
notify *notify*
*notify.setup()*
`setup`({user_config})
Configure nvim-notify
See: ~
|notify.Config|
|notify-render|
Parameters~
{user_config} `(notify.Config|nil)`
Default values:
>lua
{
background_colour = "NotifyBackground",
fps = 30,
icons = {
DEBUG = "",
ERROR = "",
INFO = "",
TRACE = "✎",
WARN = ""
},
level = 2,
minimum_width = 50,
render = "default",
stages = "fade_in_slide_out",
timeout = 5000,
top_down = true
}
<
*notify.Options*
Options for an individual notification
Fields~
{title} `(string)`
{icon} `(string)`
{timeout} `(number|boolean)` Time to show notification in milliseconds, set to false to disable timeout.
{on_open} `(function)` Callback for when window opens, receives window as argument.
{on_close} `(function)` Callback for when window closes, receives window as argument.
{keep} `(function)` Function to keep the notification window open after timeout, should return boolean.
{render} `(function|string)` Function to render a notification buffer.
{replace} `(integer|notify.Record)` Notification record or the record `id` field. Replace an existing notification if still open. All arguments not given are inherited from the replaced notification including message and level.
{hide_from_history} `(boolean)` Hide this notification from the history
{animate} `(boolean)` If false, the window will jump to the timed stage. Intended for use in blocking events (e.g. vim.fn.input)
*notify.Events*
Async events for a notification
Fields~
{open} `(function)` Resolves when notification is opened
{close} `(function)` Resolved when notification is closed
*notify.Record*
Record of a previously sent notification
Fields~
{id} `(integer)`
{message} `(string[])` Lines of the message
{level} `(string|integer)` Log level. See vim.log.levels
{title} `(string[])` Left and right sections of the title
{icon} `(string)` Icon used for notification
{time} `(number)` Time of message, as returned by `vim.fn.localtime()`
{render} `(function)` Function to render notification buffer
*notify.AsyncRecord*
Inherits: `notify.Record`
Fields~
{events} `(notify.Events)`
*notify.notify()*
`notify`({message}, {level}, {opts})
Display a notification.
You can call the module directly rather than using this:
>lua
require("notify")(message, level, opts)
<
Parameters~
{message} `(string|string[])` Notification message
{level} `(string|number)` Log level. See vim.log.levels
{opts} `(notify.Options)` Notification options
Return~
`(notify.Record)`
*notify.async()*
`async`({message}, {level}, {opts})
Display a notification asynchronously
This uses plenary's async library, allowing a cleaner interface for
open/close events. You must call this function within an async context.
The `on_close` and `on_open` options are not used.
Parameters~
{message} `(string|string[])` Notification message
{level} `(string|number)` Log level. See vim.log.levels
{opts} `(notify.Options)` Notification options
Return~
`(notify.AsyncRecord)`
*notify.history()*
`history`({opts})
Get records of all previous notifications
You can use the `:Notifications` command to display a log of previous notifications
Parameters~
{opts} `(notify.HistoryOpts)`
Return~
`(notify.Record[])`
*notify.HistoryOpts*
Fields~
{include_hidden} `(boolean)` Include notifications hidden from history
*notify.dismiss()*
`dismiss`({opts})
Dismiss all notification windows currently displayed
Parameters~
{opts} `(notify.DismissOpts)`
*notify.DismissOpts*
Fields~
{pending} `(boolean)` Clear pending notifications
{silent} `(boolean)` Suppress notification that pending notifications were dismissed.
*notify.open()*
`open`({notif_id}, {opts})
Open a notification in a new buffer
Parameters~
{notif_id} `(integer|notify.Record)`
{opts} `(notify.OpenOpts)`
Return~
`(notify.OpenedBuffer)`
*notify.OpenOpts*
Fields~
{buffer} `(integer)` Use this buffer, instead of creating a new one
{max_width} `(integer)` Render message to this width (used to limit window decoration sizes)
*notify.OpenedBuffer*
Fields~
{buffer} `(integer)` Created buffer number
{height} `(integer)` Height of the buffer content including extmarks
{width} `(integer)` width of the buffer content including extmarks
{highlights} `(table<string, string>)` Highlights used for the buffer contents
*notify.pending()*
`pending`()
Number of notifications currently waiting to be displayed
Return~
`(integer[])`
*notify.instance()*
`instance`({user_config}, {inherit})
Configure an instance of nvim-notify.
You can use this to manage a separate instance of nvim-notify with completely different configuration.
The returned instance will have the same functions as the notify module.
Parameters~
{user_config} `(notify.Config)`
{inherit?} `(boolean)` Inherit the global configuration, default true
==============================================================================
notify.config *notify.config*
*notify.Config*
Fields~
{level} `(string|integer)` Minimum log level to display. See vim.log.levels.
{timeout} `(number)` Default timeout for notification
{max_width} `(number|function)` Max number of columns for messages
{max_height} `(number|function)` Max number of lines for a message
{stages} `(string|function[])` Animation stages
{background_colour} `(string)` For stages that change opacity this is treated as the highlight behind the window. Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values
{icons} `(table)` Icons for each level (upper case names)
{on_open} `(function)` Function called when a new window is opened, use for changing win settings/config
{on_close} `(function)` Function called when a window is closed
{render} `(function|string)` Function to render a notification buffer or a built-in renderer name
{minimum_width} `(integer)` Minimum width for notification windows
{fps} `(integer)` Frames per second for animation stages, higher value means smoother animations but more CPU usage
{top_down} `(boolean)` whether or not to position the notifications at the top or not
==============================================================================
notify-render *notify-render*
Notification buffer rendering
Custom rendering can be provided by both the user config in the setup or on
an individual notification using the `render` key.
The key can either be the name of a built-in renderer or a custom function.
Built-in renderers:
- `"default"`
- `"minimal"`
- `"simple"`
Custom functions should accept a buffer, a notification record and a highlights table
>
render: fun(buf: integer, notification: notify.Record, highlights: notify.Highlights, config)
<
You should use the provided highlight groups to take advantage of opacity
changes as they will be updated as the notification is animated
*notify.Highlights*
Fields~
{title} `(string)`
{icon} `(string)`
{border} `(string)`
{body} `(string)`
vim:tw=78:ts=8:noet:ft=help:norl: