• 追加された行はこの色です。
  • 削除された行はこの色です。
* Nodeのjs-beautifyで整形 [#sbe732d3]

** js-beautifyのインストール [#i17a65db]

*** Node.jsのインストール [#waa79528]
- http://nodejs.org/download/

*** js-beautifyのインストール [#y5642857]
 npm -g install js-beautify

https://github.com/beautify-web/js-beautify

*** インストールされるコマンド [#s06d1350]
- js-beautify
- html-beautify
- css-beautify

** Vim設定 [#x2f29184]
*** .vim/after/ftplugin/html.vim [#q450d48b]
  " js-beautify by node - https://github.com/einars/js-beautify
  if has('unix')
      let ret = system('which html-beautify')
      if !v:shell_error
          command! -range=% -nargs=* Tidy <line1>,<line2>! html-beautify --type=html -f -<CR>
          noremap ,ft <ESC>:'<,'>! html-beautify -s 2 -f -<CR>
      endif
  elseif has('win32') || has('win64')
      let ret = system('where /Q html-beautify')
      if !v:shell_error
          command! -range=% -nargs=* Tidy <line1>,<line2>! html-beautify -s 2 -f -<CR>
          noremap ,ft <ESC>:'<,'>! html-beautify -s 2 -f -<CR>
      endif
  endif
** Vimのjs-beautifyプラグインをインストール [#tc86c885]

** 参考 [#g7961385]
https://github.com/einars/js-beautify
- ZIPファイルをダウンロードするか、git cloneして、VIMプラグインディレクトリに設置する。
- https://github.com/maksimr/vim-jsbeautify

** .vimrc設定 [#x2f29184]

 if executable('js-beautify')
   command! -range=% -nargs=* HTMLTidy <line1>,<line2>call RangeHtmlBeautify()<cr>
   command! -range=% -nargs=* JSTidy <line1>,<line2>call RangeJsBeautify()<cr>
   command! -range=% -nargs=* CSSTidy <line1>,<line2>call RangeCSSBeautify()<cr>
   command! -range=% -nargs=* JSONTidy <line1>,<line2>call RangeJsonBeautify()<cr>
 endif



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS