Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/agzam/mw-thesaurus.el

Merriam-Webster Thesaurus in Emacs
https://github.com/agzam/mw-thesaurus.el

dictionary emacs english-language merriam-webster thesaurus

Last synced: about 1 month ago
JSON representation

Merriam-Webster Thesaurus in Emacs

Awesome Lists containing this project

README

        

* 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

[[file: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):
- [[https://www.dictionaryapi.com/register/index.htm][Register free account]] at Merriam-Webster's Developer Center
- Obtain a key for Merriam-Webster Thesaurus
- Set the variable
#+begin_src emacs-lisp
(setq mw-thesaurus-api-key "YOUR-API-KEY")
#+end_src

*** 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, [[https://github.com/agzam/dot-spacemacs/blob/master/layers/ag-lang-tools/packages.el#L20][see an example]].

*** Doom module
=packages.el=:
#+begin_src emacs-lisp
(package! mw-thesaurus)
#+end_src

=config.el= example:
#+begin_src emacs-lisp
(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))))
#+end_src

* 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