On Sat, Mar 22, 2014 at 11:33 PM, Bram Moolenaar <[email protected]> wrote:

>
> ZyX wrote:
>
> > Consider the following script:
> >
> >     execute 'if 0'
> >         echo 'Not shown'
> >     else
> >         echo 'Shown'
> >     endif
> >
> > . If you source it you find that instead of 3 errors (“missing
> > :endif”, “:else without :if”, “:endif without :if”) and two messages
> > (“Not shown” and “Shown”) you will see one message (“Shown”) and no
> > errors.
> >
> > Note that `execute 'if 0'` is explicitly forbidden in help:
> >
> > >                     Note: The executed string may be any command-line,
> but
> > >                     you cannot start or end a "while", "for" or "if"
> > >                     command.  Thus this is illegal:
> > >             :execute 'while i > 5'
> > >             :execute 'echo "test" | break'
>
> The docs are wrong, using "if" is allowed.  The other two are not.


It doesn't work when it is used in nested block.

if 0
  execute 'if 1'
  endif
endif
=> E580: :endif without :if: endif

-- 
Yukihiro Nakadaira - [email protected]

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui