[EMAIL PROTECTED] wrote:
Hi,

For some reason my .vimrc must works for multiple versions of Vim.

Now, I found that in Vim 6.1 Tiny version (shipped with Redhat 9), the
following does not work:

command! -nargs=+ TestCmd echo "<args>"
TestCmd my test

The vim saids: Not an editor command: TestCmd my test

It seems that the command define are not available for the Vim 6.1 Tiny
version, but when I :help command, it doesn't show any +xxx feature reqired
for define command.

It would be Okay to disable it in the Tiny version, but I just do not know
how. since it does not reqire +xxxxx feature, I cannot use "if has() endif"
to wrap it.

Any work around?

--
Sincerely, Pan, Shi Zhu. ext: 2606




Under ":help +feature-list" (with the plus sign) we see that there is a +user_commands feature which require Normal version (or bigger).

Also, remember that it's hard to effectively test for Tiny version, since they cannot do expression evaluation, and everything from ":if" to ":endif" will be disregarded (on both sides of the "else"). The only possibility I see is something like this (untested):


----- 8< ---- killtiny.vim
        if 1
        " we got expression evaluation: OK
                finish
        endif
        set more cmdheight=1
        echoerr "Tiny version -- abort"
        echoerr "!!!"
        echoerr "!!!"
        echoerr "!!!"
        qall!
----- >8 -----

Invoke it with

        source killtiny.vim

in order to abort Vim (with an error message) if a Tiny version is being used.

Or if you just want to disable soe statements in a Tiny version, wrap them between ":if 1" and ":endif". (For a function: the definition _and_ every invocation will probably need to be wrapped that way.)


Best regards,
Tony.

Reply via email to