Skip to content

xieyonn/blink-cmp-dat-word

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blink-cmp-dat-word

Unit Tests

Fast, offline word source for blink.cmp. Pure Lua, no other dependencies.

Preview Image

Features

  • Fast
    • Use Double-Array Tire data structure to build the word completion source, with query time < 0.1 ms.
    • Use binary file for serialization, only rebuilt when the word source file is updated.
  • Async: All operations are performed asynchronously and will never block.
  • Limited spell-suggest: Help correct minor spelling mistakes.

Requirements

Quick Start

Using lazy.nvim

return {
  {
    "saghen/blink.cmp",
    dependencies = {
      "xieyonn/blink-cmp-dat-word",
    },
    opts = {
      sources = {
        default = {
          -- ...
          "datword", -- add datword to default sources
        },
        providers = {
          -- add datword provider
          datword = {
            name = "Word",
            module = "blink-cmp-dat-word",
            opts = {
              paths = {
                -- "path_to_your_words.txt", -- add your owned word files before dictionary.
                "/usr/share/dict/words", -- This file is included by default on Linux/macOS.
              },
            },
          },
        },
      },
    },
  },
}

Query words in order of opts.paths, add custom words file before dictionary files.

Options

Options are defined in blink.cmp, config path: sources.providers.datword.opts

opts = {
  paths = { "path_to_your_words" }, -- word source file paths.
  build_command = "" -- Define a Command to rebuild words, eg: `BuildDatWord`, then use `BuildDatWord!` to force rebuild cache.
  spellsuggest = false,-- Enable limited spellsuggest. eg: enter `thsi` give you `this`.
}

Word Source Files

Recommends:

  • Google-10000-english 10k most common English words.
  • /usr/share/dict/words is a standard system file on Unix-like OSes containing a large list of English words, one word per line.

Or add your own word list, with one word per line.

Related Projects

Inspired by cmp-dictionary.

About

Fast, offline word source for blink.cmp, based on a double-array trie.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published