On Sep 30, 7:34 am, Ben Fritz <[email protected]> wrote:
> On Sep 29, 4:54 am, Bee <[email protected]> wrote:
>
> > if 0 " copy this whole message and ":w test.txt"
> > vim 7.3.11 conditional bug
>
> > I have been testing my vimrc with different builds of vim.
>
> > The base of each build is:
> >   Linux -- Quirky 1.3
> >   vim 7.3.11
> >   no gui
> >   no xim
>
> > An error occurs ONLY in tiny or small, NOT normal. Did not try big or
> > huge.
>
> You're trying to use conditional logic in a tiny or small build. This
> will not work. Expression evaluation is only available in Normal
> builds or bigger.
>
> I'm not sure what trying conditional logic does without expression
> evaluation support, but error messages about commands not being
> supported are not surprising to me.
Hi Ben,
This is the information you are missing, :help :if
:if {expr1} *:if* *:endif* *:en* *E171* *E579* *E580*
:en[dif] Execute the commands until the next matching ":else"
or ":endif" if {expr1} evaluates to non-zero.
From Vim version 4.5 until 5.0, every Ex command in
between the ":if" and ":endif" is ignored. These two
commands were just to allow for future expansions in a
backwards compatible way. Nesting was allowed. Note
that any ":else" or ":elseif" was ignored, the "else"
part was not executed either.
This is a conditional PARSING problem.
As stated, the "if 0" is used to comment out a region of the vimrc.
This vimrc works on all vim versions on all platforms I work, with the
exception of the one formatted as T05().
The workaround is to use the T01() or T02() formatted version below.
I should have used ''if has("eval")'' in the example. See below.
Both tiny and small are designed skip any region bracketed with any
conditional sense (future expansions), but in one of the three
examples FAILs to parse correctly.
Only EXAMPLE 3 above, did tiny and small FAIL to parse the conditional
correctly.
I will try writing differently:
if has("eval") " tiny, small, normal parse CORRECTLY
function! T01()
let r = 1
if r > 0
let r = 0
endif
endfun
endif
if has("eval") " tiny, small, normal parse CORRECTLY
function! T02()
let r = 1
if r > 0 | let r = 0 " <<= <<= <<= only change
endif
endfun
endif
tiny and small FAIL to parse correctly when formatted like:
if has("eval") " tiny, small FAIL -- normal parse correctly
function! T05()
let r = 1 | if r > 0 " <<= <<= <<= only change
let r = 0
endif
endfun
endif
T05() is parsed fine in a normal build with all other options the
same.
Please note, these are only short examples of the code in the vimrc.
--
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