> For example, I have a string "foo", I want to get its completion
> candidates like doing i_ctrl-x_ctrl-k after word "foo", but I don't want
> to do this by hand, I want to get the candidate list and use it in
> vimscript.
There is no Vim script function to extract the lines from the popup
menu.
However, as you realize, Ctrl-X Ctrl-K in insert mode gets its data from
the files specified with the 'dictionary' option. You could extract your
data directly from those files, couldn't you?
Or, if the 'dictionary' option is empty, then the completion data comes
from the spell files for the current spelling language. Again you could
try to get your data directly from the spell files.
That's all I've got. Maybe somebody else has a better idea ...
glts