Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 3fb93a8

Browse files
chore: generated vimdoc (#233)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 677ce7d commit 3fb93a8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

doc/feline.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,43 @@ with no provider or an empty provider may be useful for things like
236236
|feline-applying-a-highlight-to-section-gaps| or just having an icon or
237237
separator as a component.
238238

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+
239276
*feline-Component-name*
240277

241278
Component name A component can optionally be given a

0 commit comments

Comments
 (0)