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


  • 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




Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at with a passion for cloud infrastructure/terraform/python/docs. More at