Skip to content

Special variable for current window in statusline function #4406

@blueyed

Description

@blueyed

It is currently not easy to have a global statusline function, that knows about if the window it is handling (called for) is the active one.
A workaround is tracking WinEnter/WinLeave (and BufWinEnter) events, and setting up a new function for windows then, but that is clumsy.

It would be much easier, if there was a special variable (e.g. v:statusline_winid) that would provide the winid of the window this statusline is for, allowing to just do let active = winid() == v:statusline_winid then.

Note that using an expression has limitations (e.g. #2829), and does not allow for returning highlight groups (%#Foo# - which get used as text).

(There is g:actual_curbuf already, but it is only available for expressions (#3299) (and also not useful when you want to know if the window is the active one).)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions