Tuesday, October 30, 2012

Re: Avoid typing, completion listing

On Tuesday, October 30, 2012 4:32:49 PM UTC-5, niva wrote:
> I think that I can use a code like that:
>
>
>
> while line(".") != line("$")
>
> norm A
>
> call complete(col('.'), mylist)
>
> endwhile
>
>
>
> But it does not work well
>
>

You can't trigger completion like this in a script. It has to be done in insert mode. "norm A" does NOT enter insert mode. See :help :normal, the stuff done as part of a :normal command needs to be a complete normal-mode operation. For example, ":norm! Ahello" will append the word "hello" to the current line *and return to normal mode*.

:help complete() says that you can trigger the popup in insert mode by using a <C-R>= in your mapping. Use the example there if you feel the need to continue using the complete() function for some reason.

But there are plenty other methods for completion. See :help ins-completion. You may instead be interesting in "dictionary" completion. See :help compl-dictionary.

--
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: