Is there a way to copy a few times a given block from command-line mode, e.g. with the :t command?

For example, how to copy the two lines (block) above the cursor -2,-1 to the current position ., 3 times with one command instead of three:

: -2,-1t.
: -2,-1t.
: -2,-1t.
  • 2
    I have a hard time understanding what you mean. Could you provide some examples to make it more clear?
    – DJMcMayhem
    Aug 30 '17 at 16:44
  • 1
    You can repeat the last Ex command with @: and further repeats can be done with @@ Aug 31 '17 at 8:25
  • Related to How to repeat the last command in Ex? — Perhaps you can try operating on a special register as muru's answer suggested: let @a = '-2,-1t.' | exe @a @a @a
    – LEI
    Sep 2 '17 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.