Using Dictionary.app with Vim

Average reading time is

I use Vim for all of my writing. This blog, my books, and basically anything longer than a quick email are written in markdown through MacVim. I find that I'm faster in Vim, which helps me stay focused on producing content.

Dictionary Preferences

I also make heavy use of a thesaurus, and I find myself constantly breaking out Dictionary.app. I have it set to show the thesaurus first, then Wikipedia, and finally the dictionary.

Marrying the Two

Vim has some built-in dictionary support, but it can't compete with seeing all of that information at a glance.

It turns out that combining the two is actually incredibly easy due to Vim's keymapping functionality and the fact that OS X's Dictionary.app registers itself as a consumer of dict:// URIs. Simply add the following to your ~/.vimrc file:

" Use \d on top of a word to look it up in Dictionary.app
nmap <silent> <Leader>d :!open dict://<cword><CR><CR>

Now, whenever you're curious about finding inventive1 ways of stating something - just type \d when your cursor is over the word.

Example

  1. …or creative, original, innovative, imaginative, ingenious, resourceful, unusual, fresh, novel, new, newfangled, experimental, avant-garde, groundbreaking, revolutionary, unorthodox, or unconventional*

Feel free to submit corrections via github