Spotlight
After the Circus

Random Sample
Old Bronze Man








contact me
jean at geemoo dot ca
Blog

Oct 27, 2006
So.. spent quite a bit of time figuring this one out, so I'm gonna write it down for my own benefit, and yours as well. Keep this post handy, it may just save your life one day.

When you're editting a utf file in vim, you may be tempted to :set encoding=utf8 so that it displays all nice and not so screwed up. This is all well and good, until you want to do a search and replace on a utf character. First off, :set your encoding to latin-1 again. For some reason, this won't work in utf8 encoding. I know not why.

Move your cursor to the offending character. Type "ay<left> to store the offending character into your 'a' register. Then do a :%s/<ctrl-r a>//. The Ctrl-r a will put the offending character into your command line. The :%s/// will do a global search and replace. Adjust to your needs.
Tags: linux, utf8, vim, nighttime, ottawa, lantern, spirit