Grepping for Characters You Might Have Accidentally Added with Vim
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
- 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
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.