Vim + Quickrun + Wsh + Typescript quickrunの設定をした。 NeoBundle 'thinca/vim-quickrun.git', { \ 'depends' : ['Shougo/vimproc', 'Shougo/unite.vim.git', 'osyo-manga/unite-quickfix', 'osyo-manga/shabadou.vim', 'jceb/vim-hier'] \ } "" vim-quickrun {{{ " quickrunの最終的なコマンドを出力する {{{ " http://d.hatena.ne.jp/osyo-manga/searchdiary?word=quickrun let s:hook = { \ "name" : "output_command", \ "kind" : "hook", \ "config" : { \ "enable" : 0, \ "log" : 0 \ } \} function! s:hook.on_ready(session, context) HierClear for command in a:session.commands execute self.config.log ? "echom command" : "echo command" endfor endfunction call quickrun#module#register(s:hook, 1) unlet s:hook " }}} " TypeScript コンパイル後にヘッダ等を追加 {{{ let s:hook = { \ "name" : "js2cmd", \ "kind" : "hook", \ "config" : { \ "enable" : 0 \ } \ } function! s:hook.on_success(session, context) let list = [] call add(list, "@if(0)==(0) ECHO OFF\r") call add(list, " pushd \"%~dp0\" > nul\r") call add(list, " CScript.exe //NoLogo //E:JScript \"%~f0\" %*\r") call add(list, " popd > nul\r") call add(list, "pause\r") call add(list, "GOTO :EOF\r") call add(list, "@end\r") call add(list, "\r") let inJs = fnamemodify(a:session.config.srcfile, ":p:r") . '.js' let outCmd = fnamemodify(a:session.config.srcfile, ":p:r") . '.cmd' echom inJs echom outCmd let utf8List = list + readfile(inJs, 'b') let cp932List = [] for line in utf8List call add(cp932List, iconv(line, "UTF-8", "CP932")) endfor call writefile(cp932List, outCmd, 'b') endfunction call quickrun#module#register(s:hook, 1) unlet s:hook " }}} let g:quickrun_config = {} let g:quickrun_config = { \ "_" : { \ "hook/output_command/enable" : 1, \ "hook/close_unite_quickfix/enable_hook_loaded" : 1, \ "hook/unite_quickfix/enable_failure" : 1, \ "hook/close_quickfix/enable_exit" : 1, \ "hook/close_buffer/enable_failure" : 1, \ "hook/close_buffer/enable_empty_data" : 1, \ "hook/echo/enable" : 1, \ "hook/echo/output_success" : "success!!!", \ "hook/echo/output_failure" : "failure...", \ "outputter" : "multi:buffer:quickfix", \ "outputter/buffer/split" : ":botright 8sp", \ "runner" : "vimproc", \ "runner/vimproc/updatetime" : 40, \ }, \ "typescript" : { \ "commad" : "tsc", \ "cmdopt" : "--nolib --out", \ "exec" : "%c %s _lib.ts %s %o %s:p:r.js", \ "hook/js2cmd/enable" : 1, \ "hook/output_command/log" : 1, \ } \ } "}}} quickrunの設定には ‘osyo-manga/shabadou.vim’ がとても便利です。 WindowsのJScriptをTypeScriptで記述するための設定。 ライブラリ的なのは、全て “_lib.ts” に記述し、実行ファイルソース上で “\r” でquickrun ! “test.ts” で quickrunすると、”_lib.ts” も含めて、”test.cmd” を生成する。