Thursday, May 15, 2008

vim tip for copying code from webpage

Sometimes copying code from webpage to vim can be painful. You might end up loosing all the newlines. So I prefer to copy (from webpages) using html source. If you use html source, you will have to replace &gt, &lt .. and lot more to <,> and stuff.

The following will do it automatically for you.
:%!perl -pne 'use HTML::Entities; $_=decode_entities($_)'

Thanks to godlygeek from #vim .