Open petRUShka opened 8 years ago
Hmm. Actually, one of the original motivation for me to create this plugin is that I don't like the menu-like synonym choosing interface, browsing dozens or even hundreds of synonyms one by one could be a very painful experience. I intended to design it to be similar to Vim's spell check function rather than auto-completion functionality, so that all options are displayed nice and clean. And you can choose the synonym with a simple number. But if you want, I guess sending the query result back to Vim's auto-completion is doable. I'll need some time to read-up on how, though.
There is one issue I can think of. If user choose to use this plugin's query result as a source for Vim's auto-completion(after it's made possible). Each auto-complete invoking key-stroke will invoke online query function, which can take seconds to complete. That might pose significant lagging. With async feature provided by NeoVim or Vim 8+, it is possible to reduce the lag time. But that is still yet to be seen.
Insert-mode auto-completion is added through completefunc
(commit 98a3d20). That is, by <ctrl-x ctrl-u>
in insert mode, online-query functionality will be invoked.
Great! I'll try it!
By the way. Is it impossible to bind ctrl-X ctrl-T
?
When I try to use ctrl-x ctrl-u
for Enlish word I catch an error:
WARNING: one or more query backends report error. Please check on thesaurus source(s).
Error detected while processing function thesaurus_query#auto_complete_integrate:
line 23:
Traceback (most recent call last):
Error detected while processing function thesaurus_query#auto_complete_integrate:
line 23:
File "<string>", line 8, in <module>
Error detected while processing function thesaurus_query#auto_complete_integrate:
line 23:
vim.error: Vim(let):E121: Undefined variable: u
When I use it for Russian word it is just:
User defined completion (^U^N^P) Pattern not found
When I use <Leader>-cs
it works perfectly both for Russian and English.
The issue is likely caused by:
utf-8
characters. Implementing it was an afterthought, so there were a lot of inconsistencies in the code. In latest commits(1b323a6), I have systematically went through all the encoding details within modules. It should work fine at this point(I have already tested it on OS X and Linux, both Vim 7.3 and Vim 7.4).
Your
User defined completion (^U^N^P) Pattern not found
for Russian query is possibly caused by not setting g:tq_language
or buffer specific b:tq_language
correctly. You should set it to either ['ru', 'en']
or 'ru'
in your ~/.vimrc to activate Russian synonym query.
I don't know if overriding ctrl-X ctrl-T
is possible. As far as I know, the documentation of Vim didn't cover it. And I don't believe it's as simple as remapping. But after reading Vim's documentation, I find completefunc
flexible enough for me to implement the insert-mode autocompletion functionality, so I coded as such.
Hope you find the fixed plugin better suited your working style. :D
There is native vim support for thesaurus:
It would be great for that plugin to replace that functionality. Because sometimes it much better for speed and convenience to have autocomplete list.