I'm trying to generate a bunch of text in vim (command mode) using for loops, e.g.
:for i in range(1,10) | put=i | endfor
this outputs 12345678910
I want to add logic inside of the for loop like the following pseudo code:
:for i in range(1,10) | if i>5 put=i endif | endfor
My issue is that, after exhausting google searches, I am unable to find the proper syntax for producing this kind of if statement. Does anyone know how to perform if, elseif and/or else statements in vim's command mode?
Edit:
so I finally found vimscript
so now I have:
func! Test()
    for i in range(1,10)
        for j in range(1,10)
            if i<10
                echo i*j
            endif
        endfor
    endfor
endfunction
so i can :call Test()
which outputs 12345678910, but it doesn't insert it into the page.. 
Every if/elseif/else/endif is a command on its own, so on one line that would be:
:for i in range(1,10) | if i > 5 | put =i | endif | endfor
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With