views:

164

answers:

1

I was going over VIM shortcuts & found the CTRL+p which acts as an autocomplete in UNIX (you know what I am saying, a dropdown list of the possible words to use, sorted by frequency of usage). It seems to detect even the most immediately typed words. How does this work in VIM? I am specifically interested in the data structures that are used for this?

Is there some indexing going on, which dynamically keeps adding new words to its index as they are typed? It has saved me tons of time off-late. By the way VIM Rocks :)

+2  A: 

The beauty of a project like Vim is that it is open source. Instructions as to how you can download the source are on the Vim Download page.

If you take a look at edit.c, you'll find a struct called compl_S. That will be a good starting point if you want to understand how Vim's completion works.

Johnsyweb
@john I could do that. But I thought I could ask for a better explanation for our myriad experts here at SO :) That way maybe I could end up learning something more...
MovieYoda
@movieyoda: Personally, I find that I learn a lot more by reading through code and actually playing with code rather than have somebody tell me what it does.
Johnsyweb