@@ -236,6 +236,43 @@ with no provider or an empty provider may be useful for things like
236
236
| feline-applying-a-highlight-to-section-gaps | or just having an icon or
237
237
separator as a component.
238
238
239
+ UPDATE PROVIDER VALUE USING TRIGGERS
240
+
241
+ Sometimes the provider value has to do some heavy operations, which makes it
242
+ undesirable to run the provider function every time the statusline is
243
+ generated. Feline allows you to conditionally re-run the provider function by
244
+ triggering an update to the provider string through either an autocmd or a
245
+ function. Until the provider function is run again, the value from the previous
246
+ execution of the provider function is used as the provider string.
247
+
248
+ Updating provider value through triggers is achieved through the `update ` key
249
+ in the `provider` table. `update ` can be either a boolean value, a table or a
250
+ function that returns a boolean value or a table. If it’s a boolean value,
251
+ then the provider will be updated if value is `true` . For example:
252
+
253
+ >
254
+ provider = {
255
+ name = 'my_provider',
256
+ -- Only update provider if there are less than 4 windows in the current tabpage
257
+ update = function()
258
+ return #vim.api.nvim_tabpage_list_wins(0) < 4
259
+ end
260
+ }
261
+ <
262
+
263
+
264
+ If it’s a table, it must contain a list of autocmds that will trigger an
265
+ update for the provider. For example:
266
+
267
+ >
268
+ provider = {
269
+ name = 'my_provider',
270
+ -- Only update provider if a window is closed or if a buffer is deleted
271
+ update = { 'WinClosed', 'BufDelete' }
272
+ }
273
+ <
274
+
275
+
239
276
*feline-Component-name*
240
277
241
278
Component name A component can optionally be given a
0 commit comments