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 →

Grepping for Characters You Might Have Accidentally Added with Vim

blog/cards/grepping-for-characters-you-might-accidentally-added-with-vim.jpg

Vim makes it kind of easy to add unwanted characters like :w to files you're editing. Let's go over how to find them.

Quick Jump: Going Over Everything

In this video we’ll use grep to quickly identify any accidental cases of adding :w, lines starting with II and lines ending with A. I found a few cases of this in my own blog posts.

Going Over Everything

Timestamps

  • 0:11 – It’s pretty easy to add accidental characters into a file with Vim
  • 1:30 – It’s not just :w that you might accidentally add to a file
  • 3:57 – Using grep to look for 3 things that might be lingering in your files
  • 6:15 – This is a good spot for creating an alias

Code

Here’s the grep command used in the video:

grep -E "(:w|^II|A$)" -Ro .

What are some other characters you might accidentally add? 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.



Comments