Created
April 24, 2013 12:40
-
-
Save jiroukaja/5451829 to your computer and use it in GitHub Desktop.
Vim call Dictionary.app on Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:dict(...) | |
let is_macunix = has('mac') || has('macunix') || has('gui_macvim') || (!executable('xdg-open') && system('uname') =~? '^darwin') | |
if(!is_macunix) | |
echohl WarningMsg | |
echomsg 'Your platform is not supported!' | |
echohl None | |
finish | |
endif | |
let word = len(a:000) == 0 ? input('Dictionary search: ', expand('<cword>')) : join(a:000, ' ') | |
call system(printf("open dict://'%s'", word)) | |
endfunction | |
command! -nargs=* Dict call <SID>dict(<f-args>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment