1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 22:30:04 +08:00
SpaceVim/bundle/cmp-dictionary/README.md
2023-06-11 21:41:39 +08:00

1.4 KiB
Vendored

cmp-dictionary

A dictionary completion source for nvim-cmp.

This plugin provides one of the easiest way to add desired completion candidates to nvim-cmp.

image

Requirements

Setting

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

local dict = require("cmp_dictionary")

dict.setup({
  -- The following are default values.
  exact = 2,
  first_case_insensitive = false,
  document = false,
  document_command = "wn %s -over",
  async = false,
  sqlite = false,
  max_items = -1,
  capacity = 5,
  debug = false,
})

dict.switcher({
  filetype = {
    lua = "/path/to/lua.dict",
    javascript = { "/path/to/js.dict", "/path/to/js2.dict" },
  },
  filepath = {
    [".*xmake.lua"] = { "/path/to/xmake.dict", "/path/to/lua.dict" },
    ["%.tmux.*%.conf"] = { "/path/to/js.dict", "/path/to/js2.dict" },
  },
  spelllang = {
    en = "/path/to/english.dict",
  },
})

See help for details.

Examples of usage

See wiki