On Wed, Mar 6, 2019 at 5:05 AM Hausen Schaff <seaspeak@gmail.com> wrote:
>
> I'm trying this in vimrc. Vim warns me an error.
>
> set statusline+=%{(&bomb=='1'&& &binary=='0' && (&fenc=='utf-8' || &fenc=='utf-2')) ? '[bom]' : ''}
>
>
> If I change the OR "||" to "&&", then everything is OK. Any advice is appreciated.
>
All spaces and vertical bars in the value must be backslash-escaped,
see :help option-backslash
Try
:set stl+=%{(&bomb\ &&\ !&binary\ &&\ ((&fenc\ ==\ ""\ &&\ &enc\ =~?\
'^u')\ \|\|\ &fenc\ =~?\ '^u')?'[bom]':""}
All these escaping backslashes will disappear in the value displayed
by ":set stl?" (without the quotes of course).
Note the use of =~? '^u' to mean "anything beginning with u or U". I
also omit =1 or =0 for a boolean variable, testing respectively for
nonzero or not(nonzero).
Best regards,
Tony.
--
--
You received this message from the "vim_use" 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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tuesday, March 5, 2019
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment