quickrun.vim ã«ã¤ãã¦èªã
ãã®è¨äºã¯ Vim Advent Calendar 2012 101æ¥ç®ã®è¨äºã«ãªãã¾ãã
ãé°æ§ã§100æ¥ç®ãè¿ãããã¨ãåºæ¥ã¾ããã
Vim Girl ちゃんかわいいよ Vim Girl ちゃん。
åå è
ã¯ã¾ã ã¾ã åéä¸ãªã®ã§ã¨ã£ã¦ããã®ãã¿ããã©ã°ã¤ã³ãªãããç´¹ä»ãã¦ã¿ãã¨ããã¨æãã¾ãã
ã¾ããæ¢ã«åå ãã¦ãã¦2åç®ãããããï¼ã£ã¦æ¹ã¯ãã®è¨äºã¸ã³ã¡ã³ããã¦é ãã°ã¹ã±ã¸ã¥ã¼ã«ã«è¿½å ããã®ã§ãã²ï¼
[quickrun.vim ã«ã¤ãã¦]
quickrun.vim ã¨ã¯ãããã¡ä¸ã®ã½ã¼ã¹ã³ã¼ããå®è¡ãã¦ããã®å®è¡çµæã Vim ã¸åºåããçºã®ãã©ã°ã¤ã³ã§ãã
quickrun.vim ã使ç¨ããäºã§ãç´ æ©ãã½ã¼ã¹ã³ã¼ããå®è¡ãããã¨ãã§ããã¾ã Vim ã¨ã®é£æºãé«ãããã¨ãåºæ¥ã¾ãã
[å°å ¥æ¹æ³]
quickrun.vim 㯠github ã§å ¬éããã¦ããããããåå¾ããäºãåºæ¥ã¾ãã
Vim ã§ãã©ã°ã¤ã³ã使ç¨ããå ´åãããã¤ãæ段ãããã¾ãã
git ãå°å
¥ããã¦ããã°ãneobundle.vim ã使ç¨ããã¨æ¯è¼çç°¡åã«ãã©ã°ã¤ã³ã管çããäºãåºæ¥ã¾ãã
neobundle.vim ã§ã®ãã©ã°ã¤ã³ã®å°å
¥æ¹æ³ã¯ä¸è¨ãåç
§ãã¦ã¿ã¦ä¸ããã
ãã以å¤ã«ã¯ pathogen ã使ç¨ããã®ãç°¡åãã¨æãã¾ãã
ãã¡ã㯠git ãå¿
è¦ãªããæå®ãããã£ã¬ã¯ããªã«ãã©ã°ã¤ã³ãå±éããã ããªã®ã§æ¯è¼çæ·å±
ãä½ãã§ãã
[使ã£ã¦ã¿ã]
å®éã«ä½¿ã£ã¦ã¿ã¾ãã
Vim ãèµ·åããã¦é©å½ãªç¡åã®ãããã¡ã«ã³ã¼ãï¼ä»å㯠Rubyï¼ãè¨è¿°ãã¾ãã
# é©å½ãª Ruby ã®ã³ã¼ã 10.times { puts "ruby" }
ã³ã¼ããè¨è¿°ãçµãã£ãã
:QuickRun ruby
ã§ãããã¡ä¸ã®ã³ã¼ãã Ruby ã®ã³ã¼ãã¨ãã¦å®è¡ããã¾ãã
å®è¡å¾ã«ã³ã¼ãã®å®è¡çµæã Vim ä¸ã«åºåããã¦ããã®ããããã¨æãã¾ãã
ã¾ããã®æã«ã³ã¼ãããã¡ã¤ã«ã«ä¿åããã«å®è¡ããäºãåºæ¥ãã®ã quickrun.vim ã®å©ç¹ã®ä¸ã¤ã§ãã
ãã®ããã« :QuickRun ã³ãã³ãã« type ï¼ä¸è¨ã®å ´åã 㨠rubyï¼ã渡ãã¦ããã® type ã§ã³ã¼ãã®å®è¡ãè¡ãã¾ãã
:QuickRun ã³ãã³ãã« type ã渡ãããªãã£ãå ´åã«ã¯å®è¡ãããããã¡ã® filetype ã®å¤ã使ç¨ããã¾ãã
2013/03/11 ç¾å¨ quickrun.vim ã§ã¯ä¸è¨ã®è¨èªã»ç°å¢ã«å¯¾å¿ãã¦ãã¾ãã
awk bash c c/C c/clang c/gcc c/vc clojure clojure/clj clojure/jark coffee cpp cpp/C cpp/clang++ cpp/g++ cpp/vc cs cs/csc cs/dmcs cs/gmcs cs/mcs cs/smcs d d/gdc d/ldc d/rdmd dart dart/dart/checked dart/dart/production dosbatch erlang eruby fortran fortran/gfortran go groovy haskell haskell/ghc haskell/ghc/core haskell/runghc io java javascript javascript/cscript javascript/nodejs javascript/phantomjs javascript/rhino javascript/spidermonkey javascript/v8 jsx lisp llvm lua markdown markdown/Markdown.pl markdown/bluecloth markdown/kramdown markdown/markdown_py markdown/pandoc markdown/redcarpet ocaml perl perl6 php python r ruby rust scala scheme scheme/gauche scheme/mzscheme sed sh typescript vim wsh zsh
ä¸è¨ã«æ¸ããã¦ãã coffee ã cpp/g++ãjavascript/nodejs ãªã©ã¨ãã£ããã®ã :QuickRun ã³ãã³ãã¸æ¸¡ããã¨ãåºæ¥ã¾ãã
quickrun.vim ãããã«ãã¯ãã«ãªã®ããããããã¨æãã¾ãã
[quickrun.vim ã®åä½ãå¶å¾¡ãã]
type 以å¤ã«ã :QuickRun ã³ãã³ãã«ãªãã·ã§ã³ã渡ããã¨ã§ quickrun.vim ã®åä½ãå¶å¾¡ããäºãåºæ¥ã¾ãã
ä¾ãã°ä¸è¨ã®ãããªæãã
" ä¸çªä¸ã«ã¦ã£ã³ãã¦ãåå²ããã¦åºå :QuickRun -outputter/buffer/split ":botright" " ã¦ã£ã³ãã¦ã®é«ããæå®ããå ´å :QuickRun -outputter/buffer/split ":botright 8sp" " åºåããªãã£ãå ´åã«åºåãããã¡ãèªåçã«éãã :QuickRun -outputter/buffer/close_on_empty 1 " quickfix ã¸ã¨åºåãã :QuickRun -outputter quickfix " å®è¡æéãè¨æ¸¬ãããã®çµæãæå¾ã«åºåãã :QuickRun ruby -hook/time/enable 1
ãã®ããã« :QuickRun ã³ãã³ãã«ãªãã·ã§ã³ã渡ããã¨ã§ quickrun.vim ã®åä½ãå¶å¾¡ããäºãåºæ¥ã¾ãã
ãã®ä»ã®ãªãã·ã§ã³ã«ã¤ãã¦ã¯
:help quickrun-commands
ã
:help quickrun-options
ãªã©ãåç
§ãã¦ä¸ããã
[quickrun_config ãè¨å®]
:QuickRun ã³ãã³ãã«ãªãã·ã§ã³ã渡ããã¨ã§ quickrun.vim ãå¶å¾¡ã§ãããã¨ãåãã£ãã¨æãã¾ãã
ããããæ¯å :QuickRun ã³ãã³ãã«ãªãã·ã§ã³ã渡ãã®ã¯æéã§ãã
ããããæ㯠g:quickrun_config ã使ç¨ãã¾ãã
g:quickrun_config ã使ç¨ãããã¨ã§ä»»æã® type ã«å¯¾ãã¦ãªãã·ã§ã³ã®ããã©ã«ãå¤ãè¨å®ãããã¨ãåºæ¥ã¾ãã
g:quickrun_config 㯠type åããã¼ã¨ããè¾æ¸ã§å®ç¾©ãã¾ãã
ä¾ãã°ãcpp/g++ ã«å¯¾ãã¦è¨å®ãããå ´åã¯ã
" g++ ã®ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã追å ãã " å®è¡æéãè¨æ¸¬ãã let g:quickrun_config = { \ "cpp/g++" : { \ "cmdopt" : "-std=c++0x", \ "hook/time/enable" : 1 \ }, \}
ã¨ãããããªè¨å®ã«ãªãã¾ãã
ããã§
:QuickRun cpp/g++
ã¨ããå ´åã« -cmdopt "-std=c++0x" 㨠-hook/time/enable 1 ãèªåçã«è¨å®ããã¾ãã
ã¾ãããã¼ã«ã¯ type ã§ã¯ãªã㦠"_" ã使ç¨ãããã¨ã§å
¨ã¦ã® type ã«å¯¾ããããã©ã«ãå¤ãè¨å®ãããã¨ãã§ãã¾ãã
* ã§ã¯ãªã㦠_ ã§ãã
*ã¯å¤ãè¨å®æ¹æ³ãªã®ã§ _ ã使ç¨ãã¾ãããã
ãããå©ç¨ããã¨
å
¨ã¦ã® type ã§åºåãããã¡ã®ã¦ã£ã³ãã¦ãä¸çªä¸ã«éããåºåããªãã£ãå ´åã«åºåãããã¡ãéãã
ã¨ããè¨å®ã¯ä¸è¨ã®ãããªå®ç¾©ã«ãªãã¾ãã
let g:quickrun_config = { \ "_" : { \ "outputter/buffer/split" : ":botright", \ "outputter/buffer/close_on_empty" : 1 \ }, \}
g:quickrun_config ã®è¨å®æ¹æ³ã«é¢ãã¦ã¯ quickrun.vim がデフォルトで設定しているコードãè¦ãã®ããããããããã¨æãã¾ãã
ï¼quickrun_config ã®ããã©ã«ãå¤ã¯ g:quickrun#default_config ã«è¨å®ããã¦ãã¾ãã
ã¨ãããäºã§ quickrun.vim ã使ç¨ããå ´åãã¾ã㯠g:quickrun_config ãèªå好ã¿è¨å®ãã¦ããã®ãããã¨æãã¾ãã
g:quickrun_config ã®è¨å®æ¹æ³ããç解ãã¦ãã¾ãã° quickrun.vim ã®ä½¿ãåæãã ãã¶ãããªãã¾ãã
ä»ã«ã b:quickrun_config ã«ãè¨å®ãããã¨ãã§ãã¾ãããããã«é¢ãã¦ã¯
:help b:quickrun_config
ãåç
§ãã¦ä¸ããã
ã¾ã b:quickrun_config 㯠g:quickrun_config ã¨ã¯è¨å®æ¹æ³ãå¾®å¦ã«éãã®ã§æ³¨æãã¦ä¸ããã
[:QuickRun ãéåæã«å®è¡ãã]
ããã©ã«ãã§ã¯ :QuickRun ãè¡ãªã£ã¦ããé㯠Vim ãæä½ãããã¨ã¯ã§ãã¾ããã
ããããããã¤ãã®æ段ãç¨ããäºã§ :QuickRun ä¸ã§ã Vim ãæä½ããäºãåºæ¥ãããã«ãªãã¾ãã
ä»å㯠vimproc ã使ç¨ãã¦ãquickrun.vim ãéåæã«å¦çãããã¨æãã¾ãã
vimproc ã使ç¨ããããã«ã¯å¥éãã©ã°ã¤ã³ãå°å
¥ããå¿
è¦ãããã¾ãã
ãã¡ãã®ãã©ã°ã¤ã³ã¯äºã .c ãã¡ã¤ã«ããã«ããã¦ããå¿
è¦ãããã®ã§æ³¨æãã¦ä¸ããã
neobundle.vim ã使ç¨ãã¦ããã®ã§ããã°ä¸è¨ã®è¨å®ã§èªåçã« vimproc ã®ãã«ããè¡ãªã£ã¦ããã¾ãã
NeoBundle 'Shougo/vimproc', { \ 'build' : { \ 'windows' : 'make -f make_mingw32.mak', \ 'cygwin' : 'make -f make_cygwin.mak', \ 'mac' : 'make -f make_mac.mak', \ 'unix' : 'make -f make_unix.mak', \ }, \ }
詳ããã¯ã
:help vimproc-install
ãåç §ãã¦ä¸ããã
ãã¦ãvimproc ã®å°å ¥ãçµãã£ãã®ã§ããã° -runner ã« vimproc ãè¨å®ãããã¨ã§éåæã« :QuickRun ãå®è¡ããäºãå¯è½ã§ãã
:QuickRun -runner vimproc
éåæå¦ç㯠quickrun.vim ã使ç¨ããä¸ã§ã»ã¼å¿
é ã®æ©è½ã ã¨æãã®ã§ g:quickrun_config ã«è¨å®ãã¦ããã¨ããã¨æãã¾ãã
" runner/vimproc/updatetime ã§åºåãããã¡ã®æ´æ°ééãããªç§ã§è¨å®ã§ãã¾ã " updatetime ãä¸æçã«æ¸ãæãããã¦ãã¾ãã®ã§æ³¨æãã¦ä¸ãã let g:quickrun_config = { \ "_" : { \ "runner" : "vimproc", \ "runner/vimproc/updatetime" : 60 \ }, \}
ããã§éãå¦çãè¡ãªã£ã¦ããéã§ã Vim ãæä½ãããã¨ãåºæ¥ã¾ããã
[:QuickRun ãçµäºããã]
:QuickRun ãçµäºããããå ´åã¯ä¸è¨ã®ãããã³ã°ãè¨å®ãã¦ããã¨ä¾¿å©ã§ãã
" <C-c> ã§å®è¡ãå¼·å¶çµäºããã " quickrun.vim ãå®è¡ãã¦ããªãå ´åã«ã¯ <C-c> ãå¼ã³åºã nnoremap <expr><silent> <C-c> quickrun#is_running() ? quickrun#sweep_sessions() : "\<C-c>"
[åºåç®æãå¤æ´ãã]
quickrun.vim ã§ã¯ -outputter ã«åºåç®æãè¨å®ããäºã§ Vim ã®ãããã¡ä»¥å¤ã«ãæ§ã
ãªå ´æã¸ã¨åºåããäºãåºæ¥ã¾ãã
ä¾ãã°ãquickfix ã¸åºåãããå ´åã¯ä¸è¨ã®ãããªè¨å®ã«ãªãã¾ãã
" å®è¡çµæã quickfix ã¸ã¨åºåãã : QuickRun -outputter quickfix
ä»ã«ãæå®ãããã¡ã¤ã«ããã©ã¦ã¶ãªããã¸ã¨åºåããäºãåºæ¥ã¾ãã
ç¹ã« HTML ãåãåºããããªã³ã¼ãã®å ´åã¯ãã©ã¦ã¶ã¸åºåããããã«ããã¨ããã¨æãã¾ãã
ä»ã®åºåç®æã«é¢ãã¦ã¯ã
:help quickrun-module-outputter
ãåç
§ãã¦ä¸ããã
[å®è¡ã«å¤±æããæã®ã¿ quickfix ã¸åºåãã]
ãã¦ãä¸è¨ã®è¨å®ã§ã¯å¸¸ã« quickfix ã¸ã¨åºåãè¡ãã¾ãã
ããããå®è¡ã«æåããæã«ã¯ buffer ã¸ã¨åºåãã¦æ¬²ããã¨æãã¾ãã
ããããæã« outputter/error ã使ç¨ãããã¨ã§å®è¡ã®æåæã¨å¤±ææã§åºåå
ãå¤æ´ããäºãåºæ¥ã¾ãã
" å®è¡ãæåããã°ãããã¡ã¸ã失æããã° quickfix ã¸åºåãã :QuickRun -outputter error -outputter/error/success buffer -outputter/error quickfix
[ç¬èªã®è¨å®ãå®ç¾©ãã]
g:quickrun_config ã«ã¯ç¬èªã®è¨å®ãå®ç¾©ãããã¨ãåºæ¥ã¾ãã
let g:quickrun_config = { \ "my_cpp" : { \ "command" : "C:/gcc/gcc4_8/bin/g++.exe", \ "exec" : "%c %o %s:p", \ "cmdopt" : "-std=c++0x -Wall -pedantic", \ }, \}
ä¸è¨ã®ãããªè¨å®ã g:quickrun_config ã¸å®ç¾©ããã¨
:QuickRun my_cpp
ã§ãã®è¨å®ã使ç¨ã㦠:QuickRun ãè¡ãªã£ã¦ããã¾ãã
ã¾ããg:quickrun_config[{filetype}].type ã«è¨å®åãè¨å®ããã¨ãã® filetype ã®æã«ãã®è¨å®åãé©ç¨ããã¾ãã
" filetype=cpp æã«ã¯ my_cpp ã®è¨å®ã使ç¨ãã let g:quickrun_config = { \ "cpp" :{ \ "type" : "my_cpp" \ }, \ "my_cpp" : { \ "command" : "C:/gcc/gcc4_8/bin/g++.exe", \ "exec" : "%c %o %s:p", \ "cmdopt" : "-std=c++0x -Wall -pedantic", \ }, \}
[è¨èªã«å¯¾ãã¦è¤æ°ã® type ãå®ç¾©ãã]
C++ ã®ããã«è¤æ°ã®ã³ã³ãã¤ã©ãåå¨ããå ´åãªã©é »ç¹ã«åãæãããããªè¨å®ãäºãè¤æ°è¨å®ãã¦ããã°ç´ æ©ãè¨å®ãåãæãããã¨ãåºæ¥ã¾ãã
" unite-quickrun_config ã使ç¨ããå ´å㯠{filetype}/ ã prefix ã¨ãã¦ä½¿ç¨ãã let g:quickrun_config = { \ "cpp" :{ \ "type" : "cpp/gcc4_8" \ }, \ \ "cpp/gcc4_6_3" : { \ "command" : "C:/gcc/gcc4_6_3/bin/g++.exe", \ "exec" : "%c %o %s:p", \ "cmdopt" : "-std=c++0x -Wall -pedantic", \ }, \ \ "cpp/gcc4_8" : { \ "command" : "C:/gcc/gcc4_8/bin/g++.exe", \ "exec" : "%c %o %s:p", \ "cmdopt" : "-std=c++0x -Wall -pedantic", \ }, \ \ "cpp/gcc4_8_03" : { \ "command" : "C:/gcc/gcc4_8/bin/g++.exe", \ "exec" : "%c %o %s:p", \ "cmdopt" : "-Wall -pedantic", \ }, \ \ "cpp/clang3_1" : { \ "command" : "C:/llvm/BUILD_3_1/bin/clang++", \ "exec" : "%c %o %s -o %s:p:r ", \ "cmdopt" : "-std=gnu++0x", \ }, \ \} " gcc 4.8 ã§ã³ã³ãã¤ã«ãã " :QuickRun cpp/gcc4_8 " gcc 4.8 㧠C++03 ã¨ãã¦ã³ã³ãã¤ã«ãã " :QuickRun cpp/gcc4_8_03 " clang 3.1 ã§ã³ã³ãã¤ã«ãã " :QuickRun cpp/clang3_1
è¨å®ãå¤æ´ããå ´å㯠unite-quickrun_config ã使ç¨ããã¨ä¾¿å©ã§ãã
ã³ã³ãã¤ã©ä»¥å¤ã«ããã使ç¨ãããªãã·ã§ã³ãç°å¢ã«ãã£ã¦åãæ¿ãããè¨å®ãªã©ãäºãå®ç¾©ãã¦ããã¨æãã¾ãã
ä»ã«ããã¹ããè¡ãè¨å®ãã·ã³ã¿ãã¯ã¹ãã§ãã¯ãè¡ãè¨å®ã追å ãã¦ããã¨ä¾¿å©ã ã¨æãã¾ãã
[ã¾ã¨ã]
ç°¡åã«ã§ãã quickrun.vim ã«ã¤ãã¦ç´¹ä»ãã¦ã¿ã¾ããã
ãã®ããã« quickrun.vim ã¯ã¨ã¦ãæè»ã«ã§ãã¦ããããã©ã«ãã§ç¨æããã¦ããè¨å®ãè±å¯ã§ãã
g:quickrun_config ã使ç¨ãããã¨ã§èªå好ã¿ã®è¨å®ãèªç±ã«ã«ã¹ã¿ãã¤ãºããäºãåºæ¥ã¾ãã
ã¾ããã³ã¼ããå®è¡ãããã ãã§ã¯ãªãã¦ãä»»æã®ã³ãã³ãã®å®è¡çµæãä»»æã®ç®æã¸ã¨åºåãããã¨ããç¹ãå©ç¨ããã¨éåæã«å¯¾å¿ãã¦ãããã¨ãç¸ã¾ã£ã¦æ§ã
ãªç¨éã«ä½¿ç¨ãããã¨ãåºæ¥ãã¨æãã¾ãã
ï¼ä¾ãã°こんな事ã¨ãã
make ãè¡ããããªè¨å®ã g:quickrun_config ã«å®ç¾©ãã¦ããã° quickrun.vim ãã make ããäºãã§ãããã®åºåçµæã Vim ã§åç
§ããäºãåºæ¥ãã®ã§ä¾¿å©ã ã¨æãã¾ãã
ä»åã¯ãã¾ãç´¹ä»åºæ¥ã¾ããã§ããããquickrun-module ãå©ç¨ãããã¨ã§ã¦ã¼ã¶å´ãèªç±ã«åºåç®æãè¨å®ã§ããããä»»æã®ã¿ã¤ãã³ã°ã§å¦çãããã¯ãããããäºãåºæ¥ã¾ãã
ããã©ã«ãã§ç¨æããã¦ãã quickrun-module ã§æºè¶³ã§ããªããªã£ã¦ãããèªå㧠quickrun-module ãä½ã£ã¦ã¿ãã®ãããã¨æãã¾ãã
quickrun-module-hook ã ã¨ç¨æããã¦ããã¿ã¤ãã³ã°ã§èªç±ã«å¦çãããã¯ããäºãåºæ¥ãã®ã§ããªã使ãåæãããã§ãã
ã¨ãããäºã§ quickrun.vim ã«ã¤ãã¦æ¸ãã¦ã¿ã¾ããã
quickrun.vim ã®å¯è½æ§ã¯ç¡é大ãªã®ã§ã¿ãªãããã©ãã©ãæ¡å¼µãã¦ã¿ã¾ãããï¼
[ããã« quickrun.vim åãé«ãã]
ã¨ãããããここら辺ãèªãã§ã¿ãã¨ããã¨æãã¾ãã
ã㨠1500è¡ä»¥ä¸ãããããã® quickrun.vim ã®è¨å®ãå
¬éãã¦ããã¾ãã
æ°ã«ãªãæ¹ã¯çºãã¦ã¿ãã¨é¢ç½ãããããã¾ããã
[åèãªã³ã¯]
- quickrun-outputter-replace_region つくった
- quickrun.vim で実行時間を計測して出力する
- quickrun.vim で既存の設定を継承して設定する
- quickrun.vim の hook に同オプションを複数渡すと…
- quickrun.vim で無名バッファでも quickfix に出力されるようにしてみた
- quickrun の runner-vimproc で実行が遅いと感じた場合の対処方法
- quickrun.vim で動的に各バージョンの Visual Studio のコンパイラを指定する
- quickrun.vim 0.6.0 でアニメーション
- unite-quickfix を公開しました
- watchdogs.vim つくりました