Suppose that using bufwinnr() I find the windows number where a given buffer is being displayed to be 2.

With that information, is there a way to display a specific string only in the airline status bar of that window, this is, of window 2?

To be more specific, of course I did find examples of how to define airline parts for custom functions (see Add custom section to airline). However, what I could not do yet is to find how:

1) define an airline part for a constant string (for example stored in a dictionary). While the possibility of creating a part with a constant string is mentioned in :h airline-advanced-customization, there's no example of that and I can't seem find it easily.

2) I can't seem to find what would be the proper way to display specific strings in each window airline, according to the window number.

Any help or resource will be appreciated.

  • Youd need to have a function called in your statusline/airline/whatever. Idk how with airline but i do this in my own statusline : github.com/benknoble/Dotfiles/blob/…
    – D. Ben Knoble
    Jan 24, 2019 at 0:03
  • Perhaps my comment makes less sense than i thought; why do you want a constant string for a buffer/window nr ?
    – D. Ben Knoble
    Jan 24, 2019 at 0:05
  • I believe you can set window specific section variables, that will be shown instead of the global sections then. Mar 5, 2019 at 13:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.