Skip to content

thesaurus_query.vim

Pre-release
Pre-release
Compare
Choose a tag to compare
@Ron89 Ron89 released this 03 Mar 20:13
· 213 commits to master since this release

The first release of thesaurus_query.vim, written mainly in Python.

What It Does

thesaurus_query.vim is made for a simple purpose: to create a simple,
sensible and functional interface for user to query synonym of a word and
replace it with user chosen candidate if that word is obtained from under
cursor.

So essentially, this plugin can query synonyms from words

  • under cursor (<LocalLeader>cs in Normal mode)
  • covered in visual mode (<LocalLeader>cs in Visual mode)
  • typed in by user in command mode (:Thesaurus [your_word])

Currently for word input from first case, a candidate list of found synonyms
will be generated, and user may replace the word under cursor with chosen
candidate or cancel the operation.

To maximize the query experience, two query backends were created:

  • Online Query Backend: querys from Thesaurus.com for
    synonym, so Internet connection is required for this backend's
    functionality.
  • Local query Backend: querys with local mthesaur.txt file. For this
    backend to work, be sure to download the file from gutenberg.org and
    place it under "~/.vim/thesaurus".

By default, query will be performed by Online Query Backend first. Only when no
synonym is found from Thesaurus.com, either due to the lack of
Internet connection or the word is not included, the plugin will turn to the
Local Query Backend for further query. This query sequence can be reversed. For
detail, please refer to
documentation.

How to Install

Install using plugin managers is prefered. Use your plugin manager of choice:

  • Pathogen
    • git clone https://github.com/ron89/thesaurus_query.vim ~/.vim/bundle/thesaurus_query.vim
  • Vundle
    • Add Bundle 'ron89/thesaurus_query.vim ' to .vimrc
    • Run :BundleInstall
  • NeoBundle
    • Add NeoBundle 'ron89/thesaurus_query.vim' to .vimrc
    • Run :NeoBundleInstall
  • vim-plug
    • Add Plug 'ron89/thesaurus_query.vim' to .vimrc
    • Run :PlugInstall

The Online Query Backend is functional by default. So without further
customization, the plugin should be good to go. However, if user want the Local
Query Backend to be functional as well, some further steps might be needed.

Configure for Local Query Backend

Download mthesaur.txt(around 24MB) file from
gutenberg.org, and place it under
folder "~/.vim/thesaurus". If user place the file elsewhere, be sure to let
this plugin know the location of your mthesaur.txt file by adding the line

    let g:thesaurus_query#mthesaurus="/directory/to/your/mthesaur.txt

into your .vimrc.

I'm not satisfied with Default experience, how can I customize it

Currently, 8 global variables and 3 commands created for you to customize
plugin's detailed behaviors. Including backend query sequence, keymappings and
result truncations. Some are described in
README.md.
And all of them are documented in detail in
documentation.