Friday, April 23, 2010

VIM - How to format Html source code

  1. :filetype indent on
  2. :set filetype=html
  3. :set shiftwidth=n (n = indent size)
  4. :set smartindent
  5. gg=G (gg = top of file, = is a shortcut of re-tindent, G = botton of file)

For 1,3,4 , you can predefine at .vimrc. While editing Html file, just do 2 and 5

VIM - How to format JavaScript source code

  1. Download this plugin jsbeautify
  2. Copy it to $HOME/.vim/plugin/
  3. In Vim, while you want to format JavaScript code, press \ff*
* From jsbeautify's document tells to press <leader>ff which in Vim <leader> by default is set to "\"

Clojure has lesser typing error problems than the others well-known dynamic typing languages

Give these snippets a try. // JS function foo () {   bar(1) } # Ruby def foo   bar(1) end ; Clojure (defn foo []    (bar 1)) As yo...