I'm trying to add whitespace on the left side of the flags section, and to hide this whitespace when flags aren't exist.
Here is what I mean:
Statusline with no flags:
:File.txt text:
:------------------------------------------:
The same, with flags:
:File.ext text [+][RO]:
:------------------------------------------:
Incorrect:
:File.ext text :
:------------------------------------------:
Colons and hyphens are used to show window size.
And here is statusline code:
set laststatus=2
set statusline=
set statusline+=%t
set statusline+=%=
set statusline+=%{strlen(&filetype)?&filetype:'text'}
"set statusline+=%{&modified?'\ \ \ \ ':''} " Works
set statusline+=%{(&modified||&readonly)?'\ \ \ \ ':''} " Doesn't work
set statusline+=%m%r
As you can see, there is an issue with 7th line.
So, there are two questions:
- How to check condition against both flags?
- A better option: is there a way to check against any flag? If we have some arbitrary flag in statusline, then add whitespace; if we don't have flags, then don't add whitespace.