unite.vim ã® action ã®è¨å®æ¹æ³ãããã
ãã®è¨äºã¯ Vim Advent Calendar 2012 310æ¥ç®ã®è¨äºã«ãªãã¾ãã
ãã¦ã前回の Vim Advent Calendar ã§ã¯ unite.vim ã® action ã«ã¤ãã¦æ¸ããã®ã§ãããä»åã¯ãã® action ã®è¨å®æ¹æ³ãªãããç°¡åã«ç´¹ä»ãã¦ã¿ããã¨æãã¾ãã
[ããã©ã«ãã® action ãè¨å®ãã]
kind ã«å¯¾ãã¦ããã©ã«ãã® action ãè¨å®ãã¾ãã
ãã® kind ãè¨å®ããã¦ããåè£ãå®è¡ï¼
" ãã£ã¬ã¯ããªã¯ vimfiler ã§éã call unite#custom#default_action('directory' , 'vimfiler') " ãã¡ã¤ã«ã¯ tabdrop ã§éã call unite#custom#default_action('file' , 'tabdrop') " 次ã®ããã« , ã§è¤æ°ã® kind ã«å¯¾ãã¦è¨å®ãããã¨ãã§ãã call unite#custom#default_action('file,buffer' , 'tabdrop')
ããã§æ³¨æããã®ã¯ãsourceãã§ã¯ãªãã¦ãkindãã«å¯¾ãã¦è¨å®ããã¨ããäºã§ãã
è¨å®ãã kind ã®ãã¹ã¦ã®ããã©ã«ã action ã«åæ ããã¾ãã
[source ã«å¯¾ãã¦ããã©ã«ãã® action ãè¨å®ãã]
ä¸è¨ã¯ kind ã«å¯¾ãã¦è¨å®ãã¾ãããã次ã®ããã«æ¸ããã¨ã§ source ãã¨ã«å¯¾ãã¦ããã©ã«ãã® action ãè¨å®ããäºãã§ãã¾ãã
ç¹å®ã® source ã®å ´åã®ã¿ããã©ã«ãã® action ãè¨å®ãããæã«æå¹ã§ãã
" source/{name}/{kind} ã®ããã« source 㨠kind ãæå®ããäºãã§ãã " source-bookmark ã® kind-directory 㯠tabvimfiler ã使ç¨ãã call unite#custom#default_action("source/bookmark/directory", "tabvimfiler") " kind ã« * ãè¨å®ããã°ãã® source ã®ãã¹ã¦ã® kind ã«å¯¾ãã¦è¨å®ããã " source-file ã®ããã©ã«ãã® action ã tabdrop ã«ãã call unite#custom#default_action("source/file/*", "tabdrop")
[action ã«å¯¾ãã¦å¥ã® action ãè¨å®ãã]
unite.vim ã§ã¯ç¹å®ã® action ãå¼ã¶ãã¼ãããã³ã°ãããã¤ãè¨å®ãããã¾ãã
ä¾ãã°ãt ãã¼ãæ¼ã㨠"tabopen" action ãå¼ã³åºããã¾ãã
ãã®æã« "tabopen" ã«å¯¾ãã¦å¥ã® action ãè¨å®ãããã¨ã§ t ãã¼ã®æåãèªå好ã¿ã«è¨å®ããäºãã§ãã¾ãã
" kind-file ã® tabopen ã tabdrop ã«ãã call unite#custom#alias('file', 'tabopen', 'tabdrop') " kind-file ã® tabopen ã tabvimfiler ã«ãã call unite#custom#alias('directory', 'tabopen', 'tabvimfiler')
ã¾ããunite#custom#default_action() ã¨åæ§ã« source ãæå®ãã¦è¨å®ãããã¨ãã§ãã¾ãã
" source-file_mru ã® tabopen ã split ã«ãã call unite#custom#alias('source/file_mru/file', 'tabopen', 'split')
ãã®ããã«èªåã«ãã£ãæåãè¨å®ããã¨æ´ã« unite.vim ã®ä½¿ãåæããããªãã¨æãã¾ãã