2008年7月27日 星期日

Vim TOhtml

過去在blog上若遇到要寫原始碼, 總是自己以 html tag 一行行改寫, 寫久了, 難免感到不便, 所以 survey 了一下, 找到以 vim 利用 tohtml.vim自動轉碼的方法。
  1. 安裝 vim-script (主要是需要 tohtml.vim)
  2. 在 /etc/vim/vimrc.local 加入

    let html_use_css=1

    這是為了產生以ccs控制版面的 html code.
  3. 在 Blogger 的 template 加入 css 的 source code

    .Constant { color: #ff6060; }
    .Statement { color: #0000ff; }


使用範例:
:10,40Tohtml, 把第十到第四十行轉成 html

tohtml.vim 也可以轉出 XML
:let use_xhtml = 1

:help tohtml for more details.

沒有留言: