Dear Vim devs,
following Bram's request, I re-send my bug report also to this list.
Please apologize the HTML mail format, I want to include pictures.
Recently I dediced to put the &ff option in my statusline. However, I
want to edit my files *always* in the unix format, even when I am on
Windows. For this reason, I want to have no message shown in the status
line if the file format is set to "unix" (`uncluttered' is the word
here). I want any other format displayed as an error (with red background).
I wrote this code
:set statusline+=@%(\ %#ErrorMsg#[%{&ff!='unix'?&ff:''}]%*%)@
@ - my debugging begin and end of string markers, in order to be able to
"see" an empty string
%(...%) - grouping is used here to make the leading empty space and the
brackets disappear if the expression yields an empty string
Results:
- if &ff is set to 'dos' or 'mac', the status line is correct:
<http://tinyurl.com/vim-statusline-dos>
- if &ff is set to 'unix', the expression produces an empty string
('@@') followed by two superfluous red spaces:
(Note the same is true for empty &ff, in this case the 'else' branch of
the ternary operator comes into force.)
If I remove the '@' markers, just two red spaces are produced.
Strangely, if I put the brackets outside of the #ErrorMsg# code,
everything works perfectly:
:set statusline+=@%(\ [%#ErrorMsg#%{&ff!='unix'?&ff:''}%*]%)@
However, that's not a good workaround - it is not exactly what I
imagined for [dos] and [mac] cases:
This is not a top-priority bug, of course; but I would appreciate any
insights.
Best wishes,
Peter
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php