Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Airline default sections depend on absolute constraints #2622

Open
Svalorzen opened this issue Jan 24, 2023 · 0 comments
Open

Airline default sections depend on absolute constraints #2622

Svalorzen opened this issue Jan 24, 2023 · 0 comments

Comments

@Svalorzen
Copy link

I was looking into customizing section z, so I went into the source code that initializes the section to copy-paste its default parts into my custom initialization function.

I've found that the airline#init#sections() function defines the default sections differently depending on some conditions; for example, for sections b and z the condition is window width:

    if airline#util#winwidth() > 79
      let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%p%%', 'linenr', 'maxlinenr', 'colnr'])
    else
      let g:airline_section_z = airline#section#create(['%p%%', 'linenr', 'colnr'])
    endif

I did a couple of tests, and it seems that this means that the section contents depends on the windows width at startup, and does not change if the window size is modified (so if it started small, it will not add the other parts to it, and vice-versa). I assume this is the same for section c which also depends on a condition (autochdir).

Considering that it looks like airline offers support for conditional parts (line airline#parts#define_minwidth and airline#parts#define_condition), is this how the default initialization is supposed to happen? If yes, and I wanted to customize sections b/c/z, should I copy-paste the startup check, or am I supposed to used the conditional parts support?

environment

  • vim: 9.0
  • vim-airline: c7460aa
  • OS: Lubuntu 20.04
  • Have you reproduced with a minimal vimrc: no
  • What is your airline configuration: default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant