自动弹出窗口中的字典建议

Rem*_*man 2 vim dictionary spell-checking popup

我使用 Vim 已经很多年了,但我仍然不知道如何在不按下任何快捷键的情况下在启用自动弹出字典建议的情况下输入文本(例如在记事本++或谷歌安卓键盘中)。

这些是我在 vimrc 中的选项:

set completeopt=longest,menuone  
set omnifunc=syntaxcomplete#Complete
Run Code Online (Sandbox Code Playgroud)

简而言之,我想要的是:
1)打字时自动弹出窗口中只有字典建议。
2) 仅在 supertab 中提供缓冲区词建议(使用 Tab 键)
(但......不包括缓冲区名称)

我怎样才能得到这个?

Men*_*ックス 5

  1. 如果您使用的是 Linux,您可以将现有的英语词典/usr/share/dict/american-english设置为或仅设置您自己的文件:
    :set dictionary+=/usr/share/dict/american-english
Run Code Online (Sandbox Code Playgroud)

作为在插入模式下完成字典的快捷方式,CTRL-X CTRL-K您需要添加以下设置:

    :set noshowmode
    :set completeopt+=noinsert
    :autocmd CursorHoldI * call feedkeys("\<c-x>\<c-k>")
    :set updatetime=500
Run Code Online (Sandbox Code Playgroud)
  1. 您可以通过调用函数(实际上是默认的函数)来限制Supertab插件仅弹出缓冲区单词SuperTabSetDefaultCompletionType
    :call SuperTabSetDefaultCompletionType("<c-x><c-n>")
Run Code Online (Sandbox Code Playgroud)

但你仍然需要按CTRL-X 之前TAB

  1. 禁用 NeoComplete 插件
    :NeoCompleteDisable
Run Code Online (Sandbox Code Playgroud)
:help ins-completion
Run Code Online (Sandbox Code Playgroud)
(...)

Completion can be done for:

1. Whole lines                                          i_CTRL-X_CTRL-L
2. keywords in the current file                         i_CTRL-X_CTRL-N
3. keywords in 'dictionary'                             i_CTRL-X_CTRL-K
4. keywords in 'thesaurus', thesaurus-style             i_CTRL-X_CTRL-T
5. keywords in the current and included files           i_CTRL-X_CTRL-I
6. tags                                                 i_CTRL-X_CTRL-]
7. file names                                           i_CTRL-X_CTRL-F
8. definitions or macros                                i_CTRL-X_CTRL-D
9. Vim command-line                                     i_CTRL-X_CTRL-V
10. User defined completion                             i_CTRL-X_CTRL-U
11. omni completion                                     i_CTRL-X_CTRL-O
12. Spelling suggestions                                i_CTRL-X_s
13. keywords in 'complete'                              i_CTRL-N
Run Code Online (Sandbox Code Playgroud)

编辑:

这与此答案下方的评论有关:这是PopUpDict.vim我编码的一个小脚本(可以改进),它在键入3 个字符后自动弹出字典中匹配的单词,并且使您能够在之后弹出匹配的缓冲区关键字输入ctrl-x tab:(较新版本的 vim >= 7.4)

:help ins-completion
Run Code Online (Sandbox Code Playgroud)

演示

在此处输入图片说明