Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Moving Lines Up and Down in Vim without Using the Clipboard

moving-lines-up-and-down-in-vim-without-using-the-clipboard.jpg

In this video we'll go over moving 1 line up or down in normal mode and also moving multiple lines in visual mode without plugins.

Quick Jump:

I recently added these mappings to my dotfiles and it’s been a nice quality of life improvement for moving variables or blocks of code up and down 1 or more lines.

In some use cases it ends up being faster than using dd and this also has the added benefit of not overwriting your system clipboard if you happen to be using the set clipboard=unnamedplus setting in Vim.

# Going Over the Mappings

Timestamps

  • 0:09 – Moving 1 or more lines up and down with K and J
  • 0:43 – At the moment there’s no mapping for insert mode
  • 0:57 – I found these mappings on the Vim Fandom page
  • 2:13 – They’re referenced in my dotfiles

Reference Links

Are you going to be using these mappings? Let us know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per year (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.



Comments