normal·mode
~ / ex / copy-and-move-lineslesson 2/7

Copy and move lines: :t and :m

Duplicate or move whole lines to any address with one command.

4 drills

  1. Copy the cursor line: Copy the cursor line to where the target has a second copy of it, with :t and a destination: . (just below), $ (the end) or 0 (the top).
  2. Move the cursor line: Move the cursor line to where it is in the target with one :m: :m0 (top), :m$ (end), :m+1 (down one) or :m-2 (up one).
  3. Fetch a line from elsewhere: The target has a copy of a line from higher up, just below the cursor. Copy it there with :{N}t. without moving the cursor.
  4. Move or copy a selection: Select the cursor line and the one below it with Vj, then press : and finish the command (m0, m$ or t$) to put them where the target has them.

The drill editor loads in your browser.

outside the editor the page is in normal mode: ? keymaps · / find · : commandsfound this useful? ☕ support it ·credits · source · not affiliated with Vim or Neovim