Skip to content

Instantly share code, notes, and snippets.

@ErykDarnowski
Last active January 4, 2024 11:17
Show Gist options
  • Save ErykDarnowski/90f7cf237c0f98b87aa1d41b8647202b to your computer and use it in GitHub Desktop.
Save ErykDarnowski/90f7cf237c0f98b87aa1d41b8647202b to your computer and use it in GitHub Desktop.
Copy multiple lines of text in front of other multiple lines of text in Vim

Copy multiple lines of text in front of other multiple lines of text in Vim

  1. Prep the initial multiline by for instance adding padding (e.g. on the right side of numbers)
  2. Select the multiline text you would like to copy
    1. Go to the first line
    2. Enter visual block mode (Ctrl + v or q)
    3. Move to the last line
    4. Go to the end of the line (Shift + 4)
  3. Cut it (d)
  4. Paste the initial multiline text to target multiline text
    1. Move cursor to the first line of the target text
    2. When inserting, account for the padding (Shift + a - goes in to insert mode at the end of the line)
    3. Exit insert mode (Ctrl + [ or Esc)
    4. Paste (p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment