Re: script boolean operators
On 4/10/07, Horvath Adam <[EMAIL PROTECTED]> wrote: Thanks, it's really straightforward, but where is it in the manual? http://vimdoc.sourceforge.net/htmldoc/usr_41.html - here I can not find. Notice that usr_41.html is not all-covering. It is not a *reference*. It is only a manual(tutorial). Details which do not appear in tutotial (usr_NN) vimdocs are found in the *reference* pages. You find *reference* pages by several methods: - by help tags completion: :help expression - get familiar with list of reference vimdocs: :cd $VIMRUNTIME/doc :!ls - by / search within vimdoc - by bruteforce search through all vimdocs: :helpgrep The relevant reference doc in this case is ':help eval' -- it covers everything about expression evaluation. Specificallyabout && and ||: You can find && and || under: :help expression-syntax then 5 lines below you have: |expr2|.expr3 || expr3 logical OR |expr3|.expr4 && expr4 logical AND Additionally, you can notice that vim expression syntax is rather C-like. This explains spelling of many C ops (==, &&, ||, ). Yakov
Re: script boolean operators
On środa 11 kwiecień 2007, Jürgen Krämer wrote: > > > > normal G > > let numberofrows = line(".") > > oh, and the above two statements can also be replaced by > > let numberofrows = line("$") > Very good advice. normal command can cause flickering of screen when executing scripts. m.
Re: script boolean operators
Horvath Adam wrote: Thanks, it's really straightforward, but where is it in the manual? http://vimdoc.sourceforge.net/htmldoc/usr_41.html - here I can not find. see the help topic in my post of a few minutes ago. Rather than searching vimdoc, man or google, in Vim your first resource should be the online help. To learn how it works, open Vim and enter one of the following: :help :help :help :help {subject} :help :helpgrep In addition, ":help pattern" tries to find a subject corresponding to the pattern. Hit again for more possibilities. Or set 'wildmenu' and see them all on the bottom statusline (select by and , accept by , abort by ). Or replace by and see all possible completions at once. Best regards, Tony. -- Death is only a state of mind. Only it doesn't leave you much time to think about anything else.
Re: script boolean operators
Jürgen Krämer wrote: Hi, Horvath Adam wrote: I can not find (manual, list-archiv, google) how to use boolean operators (and, or) in script. I prefer this: if i>500 and i<1000 "boolean and" is written as "&&" and "boolean or" is written as "||". So your example becomes if i>500 && i<1000. One working solution: normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 if i<1000 " do something endif endif let i += 1 endwhile Any other way? normal G let numberofrows = line(".") oh, and the above two statements can also be replaced by let numberofrows = line("$") normal gg let i = 1 while i<=numberofrows if i>500 && i<1000 " do something endif let i += 1 endwhile Regards, Jürgen Best regards, Tony. -- In Lexington, Kentucky, it's illegal to carry an ice cream cone in your pocket.
Re: script boolean operators
Horvath Adam wrote: Hi, I can not find (manual, list-archiv, google) how to use boolean operators (and, or) in script. I prefer this: if i>500 and i<1000 if (i > 500) && (i < 1000) The parentheses are not really necessary but I use them for clarity. see ":help expression-syntax" One working solution: normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 if i<1000 " do something endif endif if (i > 500) && (i < 1000) " do something endif let i += 1 endwhile Any other way? Thanks, Aruna or in the exact case above, let nrows = line(".") let i = 501 while i <= min([999, nrows]) " do something let i += 1 endwhile let i = 1000 Best regards, Tony. -- "Hit any key to continue" is very confusing when you have two keyboards.
Re: script boolean operators
Thanks, it's really straightforward, but where is it in the manual? http://vimdoc.sourceforge.net/htmldoc/usr_41.html - here I can not find. while i<=numberofrows if i>500 && i<1000 " do something
Re: script boolean operators
Hi, Horvath Adam wrote: > > I can not find (manual, list-archiv, google) how to use boolean > operators (and, or) in script. > > I prefer this: > if i>500 and i<1000 "boolean and" is written as "&&" and "boolean or" is written as "||". So your example becomes if i>500 && i<1000. > One working solution: > > normal G > let numberofrows = line(".") > normal gg > let i = 1 > while i<=numberofrows > if i>500 > if i<1000 > " do something > endif > endif > let i += 1 > endwhile > > Any other way? normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 && i<1000 " do something endif let i += 1 endwhile Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
script boolean operators
Hi, I can not find (manual, list-archiv, google) how to use boolean operators (and, or) in script. I prefer this: if i>500 and i<1000 One working solution: normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 if i<1000 " do something endif endif let i += 1 endwhile Any other way? Thanks, Aruna