Clojure code with Vim in WordPress

31 Oct

As of now WordPress doesn’t support pretty print of clojure code.
But fear not… To embed nicely formatted line-numbered code into default WordPress blog using vim.

  1. Open your file in vim.
    :set number
  2. Visually select code.
  3. Select html between

  4. Paste it in your blog (in HTML view) inside

  5. Don’t switch to Visual view. Save/update your post.

That is it. Here is a sample.

2011-01-13 Update
Default format of TOhtml changed in recent version of Vim (7.3.46 for Windows). It uses css styles from page header element. To get inline styles:

   :let g:html_use_css = 0

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: