How to get completion candidates in files in 'dictionary' option?

37 views
Skip to first unread message

WU Yue

unread,
Nov 14, 2012, 2:35:05 AM11/14/12
to vim...@googlegroups.com
Hi, list,

I have a question, I want to get a string's completion candidates in files
in 'dictionary' option.

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.

My English is poor, if it confuses you, please let me know, thank you!

--
Regards,
WU Yue

State Key laboratory of Natural Products and Functions
Key Laboratory of Modern Chinese Medicines
Department of Traditional Chinese Medicine
China Pharmaceutical University
No.24, Tongjia Xiang Street, Nanjing 210009, China

glts

unread,
Nov 14, 2012, 2:20:53 PM11/14/12
to vim...@googlegroups.com
Hi

> 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

WU Yue

unread,
Nov 14, 2012, 9:22:06 PM11/14/12
to vim_use
Thanks glts, it's a way, but if the file is large, the speed of reading a
file and extracting it would be very slow, that's why I'm searching a way
to get the result from vim dictionary feature.
Reply all
Reply to author
Forward
0 new messages