All Projects → uga-rosa → cmp-dictionary

uga-rosa / cmp-dictionary

Licence: MIT License
nvim-cmp source for dictionary.

Programming Languages

lua
6591 projects
Vim Script
2826 projects

Labels

Projects that are alternatives of or similar to cmp-dictionary

cmp-under-comparator
nvim-cmp comparator function for completion items that start with one or more underlines
Stars: ✭ 77 (+28.33%)
Mutual labels:  nvim-cmp
cmp-treesitter
cmp source for treesitter
Stars: ✭ 69 (+15%)
Mutual labels:  nvim-cmp
cmp-path
nvim-cmp source for path
Stars: ✭ 137 (+128.33%)
Mutual labels:  nvim-cmp
cmp-skkeleton
skkeleton source for nvim-cmp
Stars: ✭ 12 (-80%)
Mutual labels:  nvim-cmp
cmp-nvim-ultisnips
nvim-cmp source for ultisnips
Stars: ✭ 61 (+1.67%)
Mutual labels:  nvim-cmp
cmp-nvim-lsp-document-symbol
nvim-cmp source for textDocument/documentSymbol via nvim-lsp.
Stars: ✭ 88 (+46.67%)
Mutual labels:  nvim-cmp
cmp-rg
ripgrep source for nvim-cmp
Stars: ✭ 165 (+175%)
Mutual labels:  nvim-cmp
crates.nvim
A neovim plugin that helps managing crates.io dependencies
Stars: ✭ 252 (+320%)
Mutual labels:  nvim-cmp
cmp-spell
spell source for nvim-cmp based on vim's spellsuggest.
Stars: ✭ 99 (+65%)
Mutual labels:  nvim-cmp
cmp luasnip
luasnip completion source for nvim-cmp
Stars: ✭ 290 (+383.33%)
Mutual labels:  nvim-cmp
nvim-cmp
A completion plugin for neovim coded in Lua.
Stars: ✭ 4,534 (+7456.67%)
Mutual labels:  nvim-cmp
cmp-emoji
nvim-cmp source for emoji
Stars: ✭ 99 (+65%)
Mutual labels:  nvim-cmp
cmp-latex-symbols
Add latex symbol support for nvim-cmp.
Stars: ✭ 82 (+36.67%)
Mutual labels:  nvim-cmp
nvim
Structure, documented, super fast neovim configuration. 可能是翻斗花园最好用的 neovim 配置[^1]。
Stars: ✭ 223 (+271.67%)
Mutual labels:  nvim-cmp
cmp-tmux
Tmux completion source for nvim-cmp and nvim-compe
Stars: ✭ 98 (+63.33%)
Mutual labels:  nvim-cmp
nvim-fennel-lsp-conjure-as-clojure-ide
Basic config to transform your NVIM in a powerful Clojure IDE using fennel, clojure-lsp and conjure.
Stars: ✭ 144 (+140%)
Mutual labels:  nvim-cmp
cmp-vsnip
nvim-cmp source for vim-vsnip
Stars: ✭ 70 (+16.67%)
Mutual labels:  nvim-cmp

cmp-dictionary

Dictionary completion source for nvim-cmp

Usage

Example setting

require("cmp").setup({
  -- other settings
  sources = {
    -- other sources
    {
      name = "dictionary",
      keyword_length = 2,
    },
  }
})

require("cmp_dictionary").setup({
    dic = {
        ["*"] = { "/usr/share/dict/words" },
        ["lua"] = "path/to/lua.dic",
        ["javascript,typescript"] = { "path/to/js.dic", "path/to/js2.dic" },
        filename = {
            ["xmake.lua"] = { "path/to/xmake.dic", "path/to/lua.dic" },
        },
        filepath = {
            ["%.tmux.*%.conf"] = "path/to/tmux.dic"
        },
    },
    -- The following are default values, so you don't need to write them if you don't want to change them
    exact = 2,
    first_case_insensitive = false,
    async = false, 
    capacity = 5,
    debug = false, 
})

Option

dic

table, default: { [*] = {}, filename = nil, filepath = nil }

All but three special keys are file types, and the values are the corresponding dictionary arrays. You can also use comma-separated file types for the key. If one dictionary, you can use a string instead of an array.

The special key filename takes a table as its value, which has keys of file names and values of corresponding dictionary array. The keys are used in exact match with the result of expand("%:t").

The special key filepath is a table in a format similar to filename. The difference is that the keys are lua patterns and are used to match expand("%:p").

The special key * is a global setting.

The priority is filename > filepath > filetype > *

exact

integer, default: 2

It decides how many characters at the beginning are used as the exact match. If -1, only candidates with an exact prefix match will be returns.

The default value is 2.
image

If set to -1.
image

first_case_insensitive

boolean, default: false

If true, it will ignore the case of the first character. For example, if you have "Example" and "excuse" in your dictionary, typing "Ex" will bring up "Example" and "Excuse" as candidates, while typing "ex" will bring up "example" and "excuse".

async

boolean default: false

If true, perform the initialization in a separate thread. If you are using a very large dictionary and the body operation is blocked, try this.

You need module mpack, so you need to install lua51-mpack or build neovim of 0.6 or higher.

capacity

integer, default 5

Determines the maximum number of dictionaries to be cached. This will prevent duplicate reads when you switch dictionaries with the settings described above.

debug

boolean, default false

If true, debug messages are output.

Where to find dictionaries

You can download dic from aspell.net or installing by package manager, xbps extract to

$ ls /usr/share/dict/
american-english  british-english  words

After installing aspell and dictionary you want, run following command to get dic for this plugin (plain text).

aspell -d <lang> dump master | aspell -l <lang> expand > my.dict

How to create your own dictionary

The dictionary is recognized as a list delimited by %s. %s is a space, \t, \n, \r, or \f. For example, if you use the following file as a dictionary, the source to be added is {"hello", "world", "!"}.

hello
world !
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].