We may earn money or products from the companies mentioned in this post.
Thank you for helping to support my work!

Sometimes I get these Word docs that need to be used in WordPress or PHPlist. Sending out mass attachments is a huge no-no so I needed a way to quickly clean these things up in vim. I’m sure there are other tools out there that could do this in one or two clicks but vim is now a major part of my workflow.

:set fileencoding=utf-8
" Leave Latin-1 behind, set to UTF-8

" Convert ampersands

" Convert elipses

" Convert double quotes, left

" Convert double quotes, right

" Convert single quotes, left

" Convert single quotes, right

" Convert N Dashes

" Convert double dashes to N Dashes

:%s/.  /. /g
" Remove double spaces after periods

:%s/.   /. /g
" Remove triple spaces after periods

" Remove double non-breaking spaces after periods

" Remove single non-breaking spaces after periods