A clean, fast thesaurus plugin for Vim that uses a standalone Go binary to query a local mthesaur.txt file.
Inspired by the Python-based thesaurus_query plugin, this implementation leverages a single Go binary for speed and simplicity.
- Fast: Written in Go for optimal performance
- Offline: Works entirely offline with local
mthesaur.txtfile - Clean: Minimal dependencies, no Python required
- Simple: Easy to use commands and key mappings
- Go compiler (only if you wish to build your own binary, otherwise ore-built binaries are available)
mthesaur.txtfile from Project Gutenberg
Assuming you have Go installed, installed and build the binary in one go (pun intended)
Using Vim-Plug
Plug 'wolandark/mthesaur-vim',{'do': 'make build'}
Download the mthesaur.txt file:
mkdir -p ~/.vim
wget http://www.gutenberg.org/files/3202/files/mthesaur.txt -O ~/.vim/mthesaur.txtUsing Vim packages
(needs Vim 8+)
git clone [email protected]:wolandark/mthesaur-vim.git ~/.vim/pack/plugins/start/mthesaur-vim
Then build the binary:
cd ~/.vim/pack/plugins/start/mthesaur-vim
make buildor
make build-all
to build for all platforms.
Alternatively, you can download pre-built binaries from realeases. See Binary Detection
The same goes for other plugin managers.
Finally Download the mthesaur.txt file:
mkdir -p ~/.vim
wget http://www.gutenberg.org/files/3202/files/mthesaur.txt -O ~/.vim/mthesaur.txtYou can choose to build the binary and install it system-wide or locally. The binary can be used independently as well.
# System-wide installation (requires sudo)
make install
# Or local installation
make install-localAdd to your PATH (if using local installation):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcVariables are optional. The plugin expects ~/.vim/mthesaur.txt by default, and auto-detects the Go binary on its own.
g:mthesaur_binary: Path to the Go binary (auto-detected if not set)g:mthesaur_file: Path to mthesaur.txt file (default: "~/.vim/mthesaur.txt")g:mthesaur_map_keys: Enable key mappings (default: 1)
The plugin automatically detects the binary in this order:
g:mthesaur_binary(if set manually){plugin_dir}/build/mthesaur(built binary){plugin_dir}/mthesaur(root directory binary)mthesaur(system PATH)
" Custom binary path (optional - auto-detection works for most cases)
let g:mthesaur_binary = "/path/to/your/mthesaur"
" Custom thesaurus file location
let g:mthesaur_file = "~/.config/nvim/thesaurus/mthesaur.txt"
" Disable key mappings
let g:mthesaur_map_keys = 0:MThesaur <word>- Look up synonyms for a word (display in buffer):MThesaurCurrentWord- Look up synonyms for word under cursor (display in buffer):MThesaurReplace <word>- Look up synonyms and replace word interactively:MThesaurReplaceCurrentWord- Look up synonyms for word under cursor and replace interactively:MThesaurInfo- Show plugin configuration and binary path information
# build the binary
make build
# build the binary for all platforms
make build-all
# Test the binary
make test
# Install system-wide
make install
# Clean build artifacts
make cleanSame as Vim. See :help license.