1 -- Performant, batteries-included completion plugin for Neovim.
2 -- https://github.com/Saghen/blink.cmp
7 require("blink-cmp").setup({
8 -- Enables keymaps, completions and signature help when true (doesn't apply to cmdline or term)
10 -- If the function returns 'force', the default conditions for disabling the plugin will be ignored
11 -- Default conditions: (vim.bo.buftype ~= 'prompt' and vim.b.completion ~= false)
12 -- Note that the default conditions are ignored when `vim.b.completion` is explicitly set to `true`
14 -- Exceptions: vim.bo.filetype == 'dap-repl'
15 --enabled = function()
16 -- return not vim.tbl_contains({ "lua", "markdown" }, vim.bo.filetype)
20 -- cmdline = { enabled = false },
23 implementation = "prefer_rust_with_warning",
25 "score", -- Primary sort: by fuzzy matching score
26 "sort_text", -- Secondary sort: by sortText field if scores are equal
27 "label", -- Tertiary sort: by label if still tied
32 -- 'prefix' will fuzzy match on the text before the cursor
33 -- 'full' will fuzzy match on the text before _and_ after the cursor
34 -- example: 'foo_|_bar' will match 'foo_' for 'prefix' and 'foo__bar' for 'full'
35 keyword = { range = "prefix" },
37 -- Disable auto brackets
38 -- NOTE: some LSPs may add auto brackets themselves anyway
39 accept = { auto_brackets = { enabled = false } },
46 -- or set via a function
49 -- preselect = function(ctx)
50 -- return vim.bo.filetype ~= "markdown"
58 -- nvim-cmp style menu
61 -- { "label", "label_description", gap = 1 },
62 -- { "kind_icon", "kind" },
67 -- Show documentation when selecting a completion item
68 documentation = { auto_show = true, auto_show_delay_ms = 2000 },
70 -- Whether to display a preview of the selected item on the current line
71 ghost_text = { enabled = false },
74 -- set to 'none' to disable the 'default' preset
77 ["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
78 ["<C-e>"] = { "hide", "fallback" },
79 ["<Tab>"] = { "accept", "fallback" },
80 --["<CR>"] = { "accept", "fallback" },
82 --["<Tab>"] = { "snippet_forward", "fallback" },
83 --["<S-Tab>"] = { "snippet_backward", "fallback" },
85 ["<Up>"] = { "select_prev", "fallback" },
86 ["<Down>"] = { "select_next", "fallback" },
87 ["<C-i>"] = { "select_prev", "fallback_to_mappings" },
88 ["<C-k>"] = { "select_next", "fallback_to_mappings" },
90 ["<C-j>"] = { "scroll_documentation_up", "fallback" },
91 ["<C-l>"] = { "scroll_documentation_down", "fallback" },
93 ["<C-n>"] = { "show_signature", "hide_signature", "fallback" },
97 -- Remove 'buffer' if you don't want text completions,
98 -- by default it's only enabled when LSP returns no items
99 default = { "lsp", "path", "snippets", "buffer" },
102 -- Always show the buffer source even when the LSP provides some completion
103 lsp = { fallbacks = {} },
107 -- Use a preset for snippets, check the snippets documentation for more information
108 snippets = { preset = "default" }, -- | "luasnip" | "mini_snippets" | "vsnip"
110 -- Experimental signature help support
111 signature = { enabled = true },