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 .

1 comment:

Rajagopal said...

use emacs+tramp oldie! you would just be able to work on any machine with your local emacs.