This is a vim plugin that retrieves the synonyms and antonyms of a given word from the website www.thesaurus.com.
The credit for the original ideas goes to Anton Beloglazov http://beloglazov.info/ and Nick Coleman http://www.nickcoleman.org/.
This plugin is implemented partially because the original plugin by Anton at https://github.com/beloglazov/vim-online-thesaurus seems to have stopped working as for 12/05/2018 with vim 8.0 on windows or Mac. The original implementation was through a bash script so a git bash installation is normally needed on windows. The current implementation eliminates this necessity by programming the core functionality in python.
- Vim must have been compiled with python support (either python 2 or python 3 would work. See the Customization section if only python 3 is supported by your vim).
- A python 2 or python 3 distribution is installed and it is working properly with Vim. The plugin relies only on standard libraries so there is no need to install extra packages in your python distribution.
To check that you have both conditions satisfied, simply fire your vim and do
:py print(“hello”)
or
:py3 print(“hello”)
If you can see the output "hello" in the message area you are good to go. If not, see the FAQ at the bottom.
For vim version > 8.0 you can install the plugin by
cd ~/.vim/pack/plugins/start/
git clone https://github.com/Ben201310/online-thesaurus-vim
NOTE: on windows this should be cd ~/vimfiles/pack/plugins/start/
For vim version < 8.0 you can use Vundle or Pathogen. Take Pathogen as an example, you can
cd ~/.vim/bundle/
git clone https://github.com/Ben201310/online-thesaurus-vim
Usage is simple.
- Put your cursor on the word whose antonyms and synonyms you would like to find, then press
<Leader>t
A preview windows will open at the bottom of the current window with retrieved content. You can close the window by pressing q
Alternatively, you can run the command
:ThesaurusCurrent<CR>
- If you want to look for a specific word ‘quick’ for example. You can run
:Thesaurus YOUOWNWORD<CR>
- If you prefer a different key map for looking up the word under your cursor, put the following in the .vimrc file
let g:use_default_key_map = 0
nnoremap YOUR_OWN_KEY :call Thesaurus_LookCurrentWord()<CR>
- By default this plugin uses python 2. To use python 3 instead, put "set pyx=3" in your .vimrc. When vim is compiled with only python 3 support, "set pyx=3" becomes compulsory.
- If your python support test does not go through,
-
type
:version
look for something like+python
or+python3
in the output. If you could not find them, you may need to reinstall your vim using a version with python support. -
If you found the
+python
or+python3
entries, you vim instalation should be fine. The problem could either be due to- your do not have a python distribution installed, or it is not stored in the $PATH enviroment variable.
- You have installed a 64-bit python distribution while your vim is a 32-bit installation, or vice versa. In this case, reinstalling python to match vim's architeture should work.
-