Xiangjiang Ma wrote:


Tony,

You are right.

Now, one vimrc works on Windows and unix with mixture of version 6, version 7.

Based on your suggestion, I have replaced "for" loop with "while" loop, and it worked!


PS: script

   " for sug in s:suglist
   "   exe 'amenu 1.5.'.pri.' PopUp.'.s:changeitem.'.'.escape(sug, ' .')
   "         \ . ' :call <SID>SpellReplace(' . pri . ')<CR>'
   "   let pri += 1
   " endfor

     while(j>0)
       let sug=s:suglist[j]
       exe 'amenu 1.5.'.pri.' PopUp.'.s:changeitem.'.'.escape(sug, ' .')
             \ . ' :call <SID>SpellReplace(' . pri . ')<CR>'
       let pri += 1
       let j -= 1
     endwhile
[...]

Note that Vim 6 doesn't know anything about datatypes other than Number (including Boolean) and String, so the above code will /parse/ OK in Vim 6 but it won't /execute/ OK. The bracket operator has only one meaning in version 6:

   stringname[n]

means the (n+1)th byte of the String stringname (i.e., the result is one byte long). In version 7 you can also use

   listname[n]

for the (n+1)th item in the List listname (and the result can be a data item of any type and size).

So IIUC the whole code snippet above should be placed somewhere within "if version >= 700", or otherwise prevented from executing in version 6.


Best regards,
Tony.

Reply via email to