VIM 同义词

vim-online-thesaurus


A Vim plugin for looking up words in an online thesaurus, Now thesaurus.com

一、原理/VIM invoke thesaurus的原理

1、利用VIM的本身的thesaurus
①. 定义一个同义词文件,比如:在文件/home/leo/mythesaurus.txt中输入important,valuable,substantial,significant
注意:确保同义词均在同一行上,尽量每个单词尾部用,(英文逗号)分隔。

②. 然后在~/.vimrc中添加该文件路径,即:set thesaurus+=/home/leo/mythesaurus.txt
具体的路径根据自己所使用的操作系统和用户名而变化。

③. 在我们输入完important时,按下 CTRL-X CTRL-T,就会弹出一个窗口,显示important的同义词,类似中文输入法的单词列表。

REFER: [vim]的关键字补全
REFER: VIM for writers
REFER: 玩转VIM编辑器-自动补全

2、利用VIM插件实现thesaurus

① 本地没有Python运行环境的,需要先从Python下载安装包。
② 下载对应的thesaurus_query.vim插件,并放到VIM的插件目录。注意区分Windows/Linux/MacOS
③ 配置vim脚本.vimrc_vimrc,添加下面的代码:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Configuration for adds-on of thesaurus_query.vim
" Open a new window below to show the thesaurus; Which is much better than
" vim's default thesaurus which open a pop-up;
" There is some problem for Chinese; Donot know the reason
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:tq_enabled_backends=["woxikon_de","jeck_ru","thesaurus_com","openoffice_en","mthesaur_txt"]
"let g:tq_mthesaur_file="C:/Program Files/Vim/gutenberg_thesaur.txt"
" let g:tq_online_backends_timeout = 0.4 " default is 1.0 second
"let g:tq_mthesaur_file="C:/Program Files/Vim/chthesaur.txt"
" nnoremap <Leader>cs :ThesaurusQueryReplaceCurrentWord<CR>

暂时还没有给其配置 快捷键-HotKey,可以自己进行设置。可以看到上面用的时gutenberg的thesaurus dictionary。

REFER: Ron89/thesaurus_query.vim

二、下载 离线/offline thesaurus/同义词

REFER: Gutenberg thesaurus
REFER: Merriam-Webster thesaurus
REFER: Ron89/thesaurus_query.vim

参考:


1、What is the best vim thesaurus file?

原文地址:https://www.cnblogs.com/xuanyuanchen/p/5872432.html