Skip to content

Instantly share code, notes, and snippets.

@jiroukaja
Created April 24, 2013 12:40
Show Gist options
  • Save jiroukaja/5451829 to your computer and use it in GitHub Desktop.
Save jiroukaja/5451829 to your computer and use it in GitHub Desktop.
Vim call Dictionary.app on Mac
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