How to Move Lines in Vim

The aim of this page📝 is to memorize line movements in Vim.

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

--

--

Infrastructure Support Engineer/Technical Writer (snowplow.io) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pavol Kutaj

Infrastructure Support Engineer/Technical Writer (snowplow.io) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com