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 >, < .. 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 .
Showing posts with label VIM. Show all posts
Showing posts with label VIM. Show all posts
Thursday, May 15, 2008
Friday, September 28, 2007
Syntax Highlighting for Code Embedded in Blogger
There are multiple ways for highlighting the syntax of code embedded in Blogger. One way is to generate HTML files directly from VIM using :TOHtml and extract the CSS part in it and use it in Blogger. You can do the same with Textmate or Emacs. Another alternative is to use Prettifier. Prettifier is very easy to use. All you need to do is add a CSS and JavaScript file in your server and link them in your blog template. Please look at the readme file for more details. In my case, Blogger does not allow me to upload JavaScript files and CSS files, so I'm hosting them on a different server. I have updated my earlier posts to use Prettify.
http://codeshepherd.blogspot.com/2007/07/eliza-loves-you-rogerian.html#links
http://codeshepherd.blogspot.com/2007/06/hello-world-orkut-chickenfoot.html#links
The Perl code has turned out bit messy, but the GreaseMonkey JavaScript code looks clean.
http://codeshepherd.blogspot.com/2007/07/eliza-loves-you-rogerian.html#links
http://codeshepherd.blogspot.com/2007/06/hello-world-orkut-chickenfoot.html#links
The Perl code has turned out bit messy, but the GreaseMonkey JavaScript code looks clean.
Subscribe to:
Posts (Atom)
