On 03/12/13 20:00, So8res wrote:
I would like to, in vimscript, determine whether vim was compiled as 'tiny'.

Specifically, I would like to determine the message history size (20 or 200, 
according as vim is tiny or larger) in vimscript.

Is there any way I can do this? Is there some feature I can check using has() 
to see how large the message history is? I browsed through the feature-list 
help docs and did not see one.

I know that I can check has('+visual') or has('+windows') or some other feature 
that is in small but not tiny, but this is not quite accurate: It's possible to 
compile --with-features=tiny --enable-visual --enable-windows.

One problem which invalidates some of the replies given so far, is that normally _neither_ Small _nor_ Tiny builds have expression evaluation built in.

This means that an :if statement, up to the corresponding :endif, and with any :elseif and :else in between, is treated as a nestable comment. _Both_ the "true" path and the "else" path will be skipped. Any expression, any :let statement, etc., appearing *outside* the range of an :if (and also not commented-out by a single double-quote character) will trigger an error in _both_ Small and Tiny builds.

For instance,

        if 1
                DoSomething
        else
                DoNothing
        endif

(where :DoSomething and :DoNothing are predefined user-commands) will never execute :DoNothing, but in _either_ a Small or a Tiny build it won't execute :DoSomething either: the _whole_ :if statement (including any :if nested inside it) will be skipped.

(The above is, maybe in somewhat more detailed language, essentially what is documented at ":help no-eval-feature". See also ":help +eval".)

You can apparently use :redir even in Tiny builds, to save the output of :version to a register or a file; but you cannot check the result by means of an :if… You will probably have to do a :substitute on the file or register (after reading or copying it into a buffer), but even so you can not even count the number of occurrences of the word "Tiny" (i.e. of the regexp /\<Tiny\>/ ) since any _counting_ (followed by :if) would require expression evaluation… I suppose you will have to _assume_ some featureset, and then write your code in such a way that any smaller featureset would error out. Ugly, I know; but for the love of me I can't come out with anything better.


Best regards,
Tony.
--
Yow!  Is this sexual intercourse yet??  Is it, huh, is it??

--
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to