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 →

Diff Selections, Files, Directories and Git History with Vim


In this video we'll go over how to diff text in a bunch of different ways using Vim and the command line.

Quick Jump: Demo Video of Diffing a Few Things with Vim

As developers we’re constantly evaluating text. Let’s go over how we can use Vim and the command line to see what changed between 2 versions of text. These are plugins and commands I’ve been using for many many months. They work very nicely in practice.

Demo Video of Diffing a Few Things with Vim

Timestamped Table of Contents

  • 1:01 – Taking a look at diffing 2 different files side by side within Vim
  • 2:08 – Modifying one of the files so we can see the add / remove diff colors
  • 2:53 – Diffing 2 different directories with Vim
  • 5:07 – Quickly applying changes from 1 diff to the other one with Vim
  • 7:04 – Going over the vdiff Bash alias to make this work
  • 8:35 – Adding 2 plugins to our .vimrc file to make everything work
  • 9:20 – Diffing selections of text from within Vim
  • 11:39 – Doing a diff in a git repo based on the current file and the last commit
  • 13:39 – Finding a list of git commits for a file and diffing any one of them
  • 14:53 – Quickly diffing 2 files on the command line with the diff tool
  • 16:13 – Running the non-aliased version of a program that you might have aliased

How do you manage diffing things in Vim / command line? Let me 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 month (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.