unite-menu の設定
わたしが使用している unite-menu の設定晒し。
unite-menu を使っていない方の参考になればと。
if !exists("g:unite_source_menu_menus") let g:unite_source_menu_menus = {} endif " unite-shortcut {{{ let g:unite_source_menu_menus.shortcut = { \ "description" : "shortcut" \} let g:unite_source_menu_menus.shortcut.candidates = [ \ [ "vimrc" , s:vimrc ], \ [ "bundles", fnamemodify(s:vimrc, ":h")."/bundles.vim" ], \ [ "local vimrc", $VIMLOCALUSER."/vimrc.vim" ], \ [ "Blog Edit", "OpenBrowser http://d.hatena.ne.jp/osyo-manga/edit" ], \ [ "ideone", "OpenBrowser http://ideone.com/" ], \ [ "neobundles", s:neobundle_root ], \ [ "original plugin", $NEOBUNDLE_ORIGIN ], \ [ "boost", $BOOST_LATEST_ROOT ], \ [ "AllMap", "Unite output:AllMap" ], \ [ "Unite Beautiful Attack", "Unite -auto-preview colorscheme" ], \ [ "Boost.MPL Ref", "OpenBrowser http://www.boost.org/doc/libs/release/libs/mpl/doc/refmanual/refmanual_toc.html" ], \] function! g:unite_source_menu_menus.shortcut.map(key, value) let [word, value] = a:value if isdirectory(value) return { \ "word" : "[directory] ".word, \ "kind" : "directory", \ "action__directory" : value \ } elseif !empty(glob(value)) return { \ "word" : "[file] ".word, \ "kind" : "file", \ "default_action" : "tabdrop", \ "action__path" : value, \ } else return { \ "word" : "[command] ".word, \ "kind" : "command", \ "action__command" : value \ } endif endfunction
command_candidates 以外で unite-menu の表記を記述順に保ちたかったのでちょっとトリッキーな事をしています。
元々は unite-menu-file、directory、uri みたいに種類別に unite-menu を定義していたんですが、これだと呼び出し方が分散してしまうので、1つの unite-menu にまとめて設定しています。
これだと呼び出し方は1つだけですみますし、内容も整理しやすいです。
今のところこの設定でだいぶ利便性が上がっています。