How to Move Lines in Vim

The aim of this page๐Ÿ“ is to memorize line movements in Vim.

Pavol Kutaj
Oct 26, 2022
Changing a template for my KB docs

1. NOTES

  • If I want to swap one line with the line above I usually do the following
dd๐Ÿ ‰๐Ÿ ‹P
  • dd will delete the line you want to move
  • it also copies it to the clipboard (pops a line)
  • ๐Ÿ ‰๐Ÿ ‹ moves up or down to where you want to insert the line
  • capital P will paste

2. LINKS

--

--

Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com