Friday, June 18, 2010

Re: alternatives to :finish

On 18/06/10 23:07, Rob Foehl wrote:
> On Fri, 18 Jun 2010, Tony Mechelynck wrote:
>
>> Tiny builds have the :finish command all right, what they lack is
>> expression-evaluation, which is needed for the :if statement. So, in a
>> tiny build, the whole scope of an :if statement, from :if to :endif,
>> is handled as a nestable comment, see ":help no-eval-feature".
>
> Thanks, Tony. It'd occurred to me that :if must be special-cased in
> -eval builds, I just hadn't discovered exactly how.
>
> That said, I have found at least two vendor builds which omit :finish
> entirely, confirmed by attempting to load a .vimrc consisting solely of:
>
> set nocompatible
> finish
> quit
>
> The builds in question load this as follows:
>
> $ vi
> Error detected while processing /home/rob/.vimrc:
> line 2:
> E319: Sorry, the command is not available in this version: finish
> $

One learns every day.

I just started my "tiny" build of Vim, and tried to :source a script
consisting only of the command "finish". Result:

E492: Not an editor command: finish

On thinking back, it is understandable, since a :finish statement
doesn't make sense if it is executed unconditionally; however, the help
for :finish doesn't mention that it requires +eval.

>
>> To make sure your script isn't sourced by tiny builds, just wrap the
>> whole script in ":if 1" ... ":endif".
>
> I'd actually been attempting something more complex -- the !has('eval')
> case was the simplest I'd tried, but I think I can get away with the
> ":if 1" method as a baseline test easily enough.
>
> Thanks!
>
> -Rob
>

Best regards,
Tony.
--
One, with God, is always a majority, but many a martyr has been burned
at the stake while the votes were being counted.
-- Thomas B. Reed

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