I'm currently writing a plugin, and got stuck with this problem.

My plugin opens a new window with all local options I want, but also sets the statusline option to display some useful information. Vim permits to set the statusline option locally to a window, and this is what I need.

The problem is the race condition between other statusline plugins (like lightline etc.) which override my statusline. Most of these plugins us WinEnter,BufEnter autocmds that trigger their update function.

Is there a way to "monopolize" the statusline for local windows?

  • 1
    Remove the offending plugin, or consult plugin's docs to see if it's possible to exclude some windows. You can't just "forbid", you'd rather "ask not to do".
    – Matt
    Commented Jul 3, 2020 at 12:27
  • @Matt I'm writing a plugin with my local statusline that appears when my plugin is running. Why should I force users to remove their statusline plugin?
    – Max_Payne
    Commented Jul 4, 2020 at 9:31
  • You can provide a function to get info of your plugin, users can use it to construct their own statusline in whatever way they like.
    – dedowsdi
    Commented Jul 4, 2020 at 11:40
  • Obviously, because you have the "race condition" with this plugin. Lightline expects that you add some "indicator component" onto it, while you're trying to replace it. To be compliant, you should export some sort of MypluginStatusline() instead.
    – Matt
    Commented Jul 4, 2020 at 12:51
  • @dedowsdi yes, but my info is not just a one-character indicator, I need the entire statusline (see example github.com/ctrlpvim/ctrlp.vim)
    – Max_Payne
    Commented Jul 4, 2020 at 14:14


Your Answer

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

Browse other questions tagged or ask your own question.