Today, I needed to update the copyright year from 2013 to 2014 in 20 plus web pages. Using a few Vim commands make this job real easy. Laziness is good.

In Vim, one can quickly make updates across multiple files using the :argdo command command. First, you need to pull the files into the Vim editor. Enter vim *.html *.php from your shell. Next, run the command :argdo %s/2013/2014/gc which will iterate over ever each file and run the find and replace command, %s/find/replace/, with a confirmation. Once all of our changes are made, you can save them with :wa, which saves all of the open buffers at once.

If you maintain your web site files, like I do, in git repository, you can run git diff to verify the changes and saved the commits. Once great feature of version control systems, like git, is being able to rollback. If you realized something is amiss, you can run git reset —hard to get your working directory back into the last commit state. Then you can restart the editing process again.

Happy Hacking.

– Chris


  1. Vim Text Editor
  2. Vim’s argdo command
  3. Vim Save All Buffers
  4. Git Version Control
  5. Git’s reset command