Wiki

by yszheda

View project onGitHub

Tip 29: Duplicate or Move Lines Using :t and :m Commnads

Return to the top: <<Practical Vim>>

Duplicate Lines with the :t Commnad

  • :t (copy TO) is short for :copy/:co
  • The format of the copy command::[range]copy {address}
  • differences between yyp and :t.: yyp uses a register, whereas :t. doesn't.

Example:

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h :copy

Move Lines with the :m Command

  • The format of the move command::[range]move {address}

Example:

Alternative for :'<,'>m$: dGp

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h :move