sponsor Vim development Vim logo Vim Book Ad

likelycomplete : Collect & rank words for completion

 script karma  Rating 0/0, Downloaded by 1670  Comments, bugs, improvements  Vim wiki

created by
Tom Link
script type
Once enabled for a filetype (see |g:likelycomplete_filetypes|), this
plugin observes any buffer of that filetype. It collects the words,
ranks them based on the probability of their occurrences (sort of) and
compiles a dictionary file that is fed to 'complete'. Any words that are
frequently used in files of enabled filetypes, are offered in the
completion list (see |i_CTRL-P|). The plugin also supports Insert mode
completion (see 'completefunc') that optionally takes into account the cursor's

The word list on disk is updated when leaving vim. It could take a few
editing sessions to get at a usable word list.


    - Generate word lists for use in 'complete' (see also |ins-completion| and
    - Set a 'completefunc' (incorporate results from the original
      'completefunc' and optionally from 'omnifunc') -- see

Additional featues for use as 'completefunc':

    - Auto-completion -- see |g:likelycomplete#auto_complete|
    - Fuzzy completion -- see |g:likelycomplete#use_fuzzy_matches|
    - Part of word completion -- see |g:likelycomplete#match_beginning|
    - Context based sorting (not available for |i_CTRL-P|) -- see
    - If finding the right completion via VIM's own popup menu is too
      cumbersome, press <C-S-Space> -- see |g:likelycomplete#select_imap|

By default only completion via |i_CTRL-P| is enabled (and only for those
filetypes listed in |g:likelycomplete_filetypes|). Most of the above options
can be enabled by setting |g:likelycomplete#experimental| to 1.
install details
In order to install the vba, open the vba file in VIM and type: >

    :so %

See :help vimball for details.

This script requires tlib (vimscript #1863) to be installed.

Also available via git: http://github.com/tomtom/likelycomplete_vim/


Users have to set |g:likelycomplete_filetypes| in |vimrc| in order to enable
LikelyComplete for certain filetypes.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
likelycomplete.vba 0.04 2014-03-27 7.0 Tom Link - GetWordsSortedByRelevance(): Minor change to weighting len(base)/len(word)
- GetCompletions: Filter list ASAP in order to reduce runtime of tlib#list#Uniq(); fix s:Readlines: return copy of lines
MD5 checksum: 8e0bd638cd179e37c391ab1802752ed4
likelycomplete.vba 0.03 2014-03-26 7.0 Tom Link - g:likelycomplete#prgname: Prefer vim if available
- likelycomplete#AsyncUpdateWordList(), s:UpdateWordList(): Escape special characters only on exec
- g:likelycomplete#base_context, g:likelycomplete#max_context
- Always insert base when called via <c-x><c-u>; remove dbg/log comments
- Call UpdateWordList() on BufDelete, not BufUnload
- Debugging, s:Run()
- g:likelycomplete#sources: Define source & order; g:likelycomplete#dictionaries: define dictionaries
- g:likelycomplete_per_window: per-window filetypes (not yet functional)
- Don't update word list when using w:likelycomplete_filetype
- Make sure not to update wordlist if sources don't include 'likelycomplete'
- FIX variable scope
- SetupComplete(): Add dictionaries to &complete and &dictionary
- Use "_" if filetype is empty; actually test likelycomplete#SetupFiletype()
- Renamed 'dict' to 'dictionaries'; support for including 'dictionary'
- g:likelycomplete#sources: Remove "?files"
MD5 checksum: c633c39845d8e2869ea26fb4cbe9561a
likelycomplete.vba 0.02 2014-03-16 7.0 Tom Link - g:likelycomplete#options_javascript; allow customization of  cms_rx
- use_words: Add the current buffer's words to the list of possible completions
- s:GetCompletions(): return unique words
- likelycomplete#ListPicker_tlib(): Temporarily set noshowmode
- g:likelycomplete#use_fuzzy_matches defaults to 0
- g:likelycomplete#use_fuzzy_matches defaults to 1 (again); slightly improved ranking for fuzzy patterns
- UpdateWordListNow: increased base value for AssessContext to 10; FIX comparison
- Make sure not to call AutoComplete twice
- Cache intermediate results in s:GetSortedCompletions()
MD5 checksum: 1f31791acf08a1f9266203c071c59f2a
likelycomplete.vba 0.1 2014-03-14 7.4 Tom Link Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.