Skip to content

agzam/mw-thesaurus.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Merriam-Webster Thesaurus

For more than 150 years, in print and now online, Merriam-Webster has been America’s leading and most-trusted provider of language information.

This package allows you to lookup a word and displays its thesaurus definition in a pleasing outline (Org-mode) format

assets/thesaurus.gif

Configure

This is entirely optional, and you don’t have to do it at all (not required for the package to work), but you may want to do it anyway:

In order to use Merriam Webster API, it is necessary to register (for free) and obtain an API Key. By default, this package uses my own registered key; for whatever reason, if you rather use your own key or the default one stops working, then you’d need to do this. I’ve been using mine for years, and it still works fine, but I can imagine some kind of spam detection mechanism adding the key into the block-list. Well, if that happens, just register a new account (again, you don’t have to pay for it, and it takes a minute):

  • Register free account at Merriam-Webster’s Developer Center
  • Obtain a key for Merriam-Webster Thesaurus
  • Set the variable
(setq mw-thesaurus-api-key "YOUR-API-KEY")

Spacemacs layer

Spacemacs users can easily add the package to dotspacemacs-additional-packages and start using it, or even add it to be part of a custom layer, see an example.

Doom module

packages.el:

(package! mw-thesaurus)

config.el example:

(use-package! mw-thesaurus
  :defer t
  :commands mw-thesaurus-lookup-dwim
  :hook (mw-thesaurus-mode . variable-pitch-mode)
  :config
  (map! :map mw-thesaurus-mode-map [remap evil-record-macro] #'mw-thesaurus--quit)

  ;; window on the right side
  (add-to-list
   'display-buffer-alist
   `(,mw-thesaurus-buffer-name
     (display-buffer-reuse-window
      display-buffer-in-direction)
     (direction . right)
     (window . root)
     (window-width . 0.3))))

Commands

mw-thesaurus-lookup-dwim - bind that to any desired hotkey, and it would automatically search for a thesaurus definition using the region (if you have any text selected) or a word at the point, or if there’s nothing - it prompts you for a word.

Keys available in mw-thesaurus-mode

RET lookup for the word at the cursor (lets you “drill” into definition further)

q kill mw-thesaurus buffer and close the window