Vim Recall繁體中文

Copy lines without a register

:2t$

Example

Normal mode. Lines 1–3: alpha, beta, gamma.

Before
alpha
beta
gamma
  1. :2t$<CR> Copy line 2 to the end · alpha, beta, gamma, beta
After
alpha
beta
gamma
beta
Details & Vim help

Duplicate a line directly to a destination address.

Copy a line while preserving your yank and delete registers.

The destination is the line after which the copy is inserted; address 0 means the start of the buffer. :t is an alias for :copy.

Try it in Vim

  1. In the example, type :2t$<CR>.
  2. 2 is the source line; $ means after the last line.
  3. Use a range, such as :2,4t0, to copy several lines before line 1.