Vim dictionary lookup command - 01-11-20

As I author all my blog posts, including this text, as markdown documents with vim sometime I come across a word I’d like to lookup. Today I’ve added a vim command to do just this.

snippet from .vimrc or .nvimrc

function! LookUpDef(word)
    silent !clear
    execute "!open https://www.wordnik.com/words/" . a:word
endfunction
command! -nargs=* Dic call LookUpDef(<f-args>)

Then an example vim workflow

  1. navigating to word, ex “faucet”, then yank inner word with yiw

  2. open command prompt enter command :Dic

  3. then paste yanked txt into command prompt with <C-R>”

:Dic faucet
  1. press enter and watch default browser pop up with the word searched via wordnik.com

screen recording

\- [ vim, search ]