unite.vim でシステムで関連付けされたファイルオープンをする
と、いう電波を受信したので書いてみました。
Windows だと unite-action に start を追加するとかそんな感じですね。
多分これで動くと思います。
[.vimrc]
" unite.vim に action を追加する " unite-action start let start = { \ 'description' : 'start {word}', \ 'is_selectable' : 1, \ } function! start.func(candidates)"{{{ for l:candidate in a:candidates call system("cmd /c start ".l:candidate.action__path) endfor endfunction"}}} call unite#custom_action('openable', 'start', start) unlet start
[使い方]
- unite.vim で候補を列挙
- 開きたいファイル等を選択
で action を列挙 - start を選択
- いい感じにファイルが開く
[補足]
openbrowser.vim を使用する場合はこんな感じになります。
これだと Windows 以外でも動作するのかな?
[.vimrc]
" OpenBrowser file:/ let openbrowser_file = { \ 'description' : 'OpenBrowser file:/{word}', \ 'is_selectable' : 1, \ } function! openbrowser_file.func(candidates)"{{{ for l:candidate in a:candidates call openbrowser#open('file:/'.l:candidate.action__path) endfor endfunction"}}} call unite#custom_action('openable', 'openbrowser_file', openbrowser_file) unlet openbrowser_file " action を呼び出すキーバインドを追加 au FileType unite \ nnoremap <silent> <buffer> <expr> <Space>ff unite#do_action('openbrowser_file')
使い方は、action で、openbrowser_file を選択する以外は、上記の設定と同じです。