How VIM Autocomplete Work
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 开发者_如何学JAVAto its index as they are typed? It has saved me tons of time off-late. By the way VIM Rocks :)
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.
精彩评论