Sunday, June 3, 2012

Re: exists("##ColorScheme")

On Sunday, June 3, 2012 10:24:29 AM UTC-5, Christian Brabandt wrote:
> Hi Thilo!
>
> On So, 03 Jun 2012, Thilo Six wrote:
>
> > :if globpath(&rtp, 'colors/desert.vim') | echo "yes" | else | echo "no" | endif
> > no
>
> Yeah, it returns several matches. Better would be:
>
> :if len(globpath(&rtp, 'colors/desert.vim')) | echo "yes" | else | echo "no" | endif
> yes
>

What about the empty() function, for clarity and speed?


empty({expr}) *empty()*
Return the Number 1 if {expr} is empty, zero otherwise.
A |List| or |Dictionary| is empty when it does not have any
items. A Number is empty when its value is zero.
For a long |List| this is much faster than comparing the
length with zero.

--
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

No comments:

Post a Comment