Vim - if/elseif/else statements in for loop (command mode) -


i'm trying generate bunch of text in vim (command mode) using loops, e.g.

:for in range(1,10) | put=i | endfor 

this outputs 12345678910

i want add logic inside of loop following pseudo code:

:for in range(1,10) | if i>5 put=i endif | endfor 

my issue that, after exhausting google searches, unable find proper syntax producing kind of if statement. know how perform if, elseif and/or else statements in vim's command mode?

edit: found vimscript

so have:

func! test()     in range(1,10)         j in range(1,10)             if i<10                 echo i*j             endif         endfor     endfor endfunction 

so can :call test()

which outputs 12345678910, doesn't insert page..

every if/elseif/else/endif command on own, on 1 line be:

:for in range(1,10) | if > 5 | put =i | endif | endfor 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -