1 -- Performant, batteries-included completion plugin for Neovim.
2 -- https://github.com/Saghen/blink.cmp
8 vim.cmd.packadd("blink-emoji.nvim")
11 require("blink-cmp").setup({
12 -- Enables keymaps, completions and signature help when true (doesn't apply to cmdline or term)
14 -- If the function returns 'force', the default conditions for disabling the plugin will be ignored
15 -- Default conditions: (vim.bo.buftype ~= 'prompt' and vim.b.completion ~= false)
16 -- Note that the default conditions are ignored when `vim.b.completion` is explicitly set to `true`
18 -- Exceptions: vim.bo.filetype == 'dap-repl'
19 --enabled = function()
20 -- return not vim.tbl_contains({ "lua", "markdown" }, vim.bo.filetype)
24 -- cmdline = { enabled = false },
27 -- ToDo: re-enable after the fix https://github.com/Saghen/blink.cmp/issues/1743
28 --implementation = "prefer_rust_with_warning",
29 implementation = "lua",
31 "score", -- Primary sort: by fuzzy matching score
32 "sort_text", -- Secondary sort: by sortText field if scores are equal
33 "label", -- Tertiary sort: by label if still tied
38 -- 'prefix' will fuzzy match on the text before the cursor
39 -- 'full' will fuzzy match on the text before _and_ after the cursor
40 -- example: 'foo_|_bar' will match 'foo_' for 'prefix' and 'foo__bar' for 'full'
41 keyword = { range = "prefix" },
43 --show_on_backspace = true,
44 --show_on_backspace_in_keyword = true,
47 -- Disable auto brackets
48 -- NOTE: some LSPs may add auto brackets themselves anyway
49 accept = { auto_brackets = { enabled = false } },
56 -- or set via a function
59 -- preselect = function(ctx)
60 -- return vim.bo.filetype ~= "markdown"
68 -- nvim-cmp style menu
71 -- { "label", "label_description", gap = 1 },
72 -- { "kind_icon", "kind" },
77 -- Show documentation when selecting a completion item
78 documentation = { auto_show = true, auto_show_delay_ms = 2000 },
80 -- Whether to display a preview of the selected item on the current line
81 ghost_text = { enabled = true },
84 -- set to 'none' to disable the 'default' preset
87 ["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
88 ["<C-e>"] = { "hide", "fallback" },
89 --["<Tab>"] = { "select_next" },
90 --["<S-Tab>"] = { "select_prev" },
91 --["<Tab>"] = { "show_and_insert_or_accept_single" },
92 ["<Tab>"] = { "accept", "fallback" },
94 --["<Tab>"] = { "snippet_forward", "fallback" },
95 --["<S-Tab>"] = { "snippet_backward", "fallback" },
97 ["<Up>"] = { "select_prev", "fallback" },
98 ["<Down>"] = { "select_next", "fallback" },
99 ["<C-i>"] = { "select_prev", "fallback_to_mappings" },
100 ["<C-k>"] = { "select_next", "fallback_to_mappings" },
102 ["<C-j>"] = { "scroll_documentation_up", "fallback" },
103 ["<C-l>"] = { "scroll_documentation_down", "fallback" },
105 ["<C-n>"] = { "show_signature", "hide_signature", "fallback" },
109 -- Remove 'buffer' if you don't want text completions,
110 -- by default it's only enabled when LSP returns no items
111 default = { "path", "lsp", "snippets", "buffer", "emoji" },
114 -- Always show the buffer source even when the LSP provides some completion
115 lsp = { fallbacks = {} },
119 get_bufnrs = function()
120 return vim.api.nvim_list_bufs()
122 -- from all "normal" buffers
123 -- get_bufnrs = function()
124 -- return vim.tbl_filter(function(bufnr)
125 -- return vim.bo[bufnr].buftype == ""
126 -- end, vim.api.nvim_list_bufs())
128 -- buffers when searching with `/` or `?`
129 get_search_bufnrs = function()
130 return { vim.api.nvim_get_current_buf() }
132 retention_order = { "focused", "visible", "recency", "largest" },
134 enable_in_ex_commands = false,
138 module = "blink-emoji",
140 score_offset = 15, -- Tune by preference
142 insert = true, -- Insert emoji (default) or complete its name
143 ---@type string|table|fun():table
148 should_show_items = function()
149 return vim.tbl_contains(
150 -- Enable emoji completion only for git commits and markdown.
151 -- By default, enabled for all file-types.
152 { "gitcommit", "markdown", "jj" },
159 -- get_cwd = function(_)
160 -- return vim.fn.getcwd()
167 -- Use a preset for snippets, check the snippets documentation for more information
168 snippets = { preset = "default" }, -- | "luasnip" | "mini_snippets" | "vsnip"
170 -- Experimental signature help support
171 signature = { enabled = true },