Skip to content

girishji/ngramview-complete.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This plugin is superceded by ngram-complete. Please use it instead.


Ngram Completion Based on Google Ngrams Viewer

This plugin is a helper for Vim completion plugin Vimcomplete. It suggests (completes) next word based on bigram, trigram and 4-gram word association by querying Google Ngrams Viewer. No additional packages or databases are required.

Note: Google ngram queries can be slow and can take over a second. However, Vim's responsiveness is not affected because queries are asynchronous (:h job) and results are cached. I implemented this out of curiosity but I do not find it very useful. Your mileage may vary.

image

Requirements

  • Vim >= 9.0

Installation

Install this plugin after Vimcomplete.

Install using vim-plug.

vim9script
plug#begin()
Plug 'girishji/ngram-complete.vim'
plug#end()

For those who prefer legacy script.

call plug#begin()
Plug 'girishji/ngram-complete.vim'
call plug#end()

Or use Vim's builtin package manager.

Configuration

Default options are as follows.

vim9script
export var options: dict<any> = {
    priority: 11,    # Higher priority items are shown at the top
    maxCount: 10,    # Maximum number of next-word items shown
    cacheSize: 100,  # Each ngram takes up one slot in the cache
}
autocmd VimEnter * g:VimCompleteOptionsSet(options)