Consider the following statusline
that makes use of %r
to display [RO]
, when readonly
has been set.
The problem is that when readonly
is not set, two spaces occur between %f
(file path) and %y
(file type). The problem is even worse, if I have several items, that may sometimes not be shown, separated by spaces.
Is there a way to completely remove an item from the statusline
, when it's not shown, so that associated whitespace isn't shown?
set laststatus=2
set showcmd
set showmode
set statusline=%f
set statusline+=\ %r
set statusline+=\ %y