Wednesday, October 31, 2012

Re: Avoid typing, completion listing

On Wednesday, October 31, 2012 8:36:48 AM UTC-5, niva wrote:
>
>
> I have tried this to make autocompletion in insert mode:
>
> set dictionary=keys(myDict)
> set completeopt=menu
>

See :help 'dictionary'. You're using this option wrong. It takes file names, not a word list.

>
> But, not only keys of mydict appears when I type CTRL+N CTRL+P.
>

Dictionary completion is started with CTRL-X followed by CTRL-K.

>
> The menu appears and contains all lines of all opened buffers.
>

Probably because CTRL-N and CTRL-P by themselves will start generic completion, controlled by the 'complete' option. By default all words from all loaded buffers, windows, unloaded buffers in the buffer list, tags, and included files are included in the completion list.

>
>
> How can I do to restrain on keys of my Dict ?
>

Put your words in a file or set of files and use CTRL-X CTRL-K to start your completion.

Incidentally, I just discovered from the help that if 'dictionary' is empty or contains the word "spell", dictionary completion USES THE SPELLING DICTIONARY. I have a new Vim feature to play with! My day just got way better.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment