Am 30.09.2010 22:08, schrieb Ben Fritz: > On Sep 30, 11:28 am, Bee<beeyaw...@gmail.com> wrote: >> On Sep 30, 7:34 am, Ben Fritz<fritzophre...@gmail.com> wrote: >>> 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. >> >> >> 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. >> > > Actually, this says absolutely nothing about small or tiny builds of > Vim 7.3. I take it, you expect Vim 7.3 Tiny to act like Vim 4.5 in > this case? This does seem reasonable, but is not explicitly stated. I > think you're right and that's how it's supposed to work. > >> 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: >> > > Thanks, your new example is much clearer. > >> 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. >> > > This does look like a bug. However, I note that :let is an expression- > related command. Maybe :let commands without +eval just ignore > everything on the line without checking for more commands? I'm not > sure if there's really a way around this, since expressions cannot be > parsed without +eval. > > What happens if you replace the "let r = 1" command with a :set > command or something else that does not relate to expression > evaluation? I'm more curious than anything else...I don't have the > knowledge of Vim's code or the desire to use a Tiny/Small build to > even begin to know how to fix this.
I don't know the details either, but it's not surprising that a script line like let r = 1 | if r > 0 fails with a small version. Without parsing the expression after :let, how should a small vim know (how would you know) that the bar after :let separates from the following :if and is not part of a string? e.g. let r = "foo" . "| if r > 0" After all, it looks like bad style anyway ... -- Andy -- 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