|
1 |
| -local neokinds = require "neokinds" |
| 1 | +return { |
| 2 | + "saghen/blink.cmp", |
| 3 | + dependencies = "rafamadriz/friendly-snippets", |
2 | 4 |
|
3 |
| -require("blink-cmp").setup { |
4 |
| - completion = { |
5 |
| - -- TODO: fix this |
6 |
| - -- this block of code for some reason is breaking the whole plugin |
7 |
| - --list = { |
8 |
| - -- selection = { |
9 |
| - -- preselect = true, |
10 |
| - -- auto_insert = false, |
11 |
| - -- }, |
12 |
| - -- }, |
13 |
| - menu = { |
14 |
| - border = "rounded", |
15 |
| - winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", |
16 |
| - draw = { |
17 |
| - components = { |
18 |
| - label = { |
19 |
| - text = require("colorful-menu").blink_components_text, |
20 |
| - highlight = require("colorful-menu").blink_components_highlight, |
21 |
| - }, |
22 |
| - kind_icon = { |
23 |
| - text = function(ctx) |
24 |
| - local icon = neokinds.config.completion_kinds[ctx.kind] or "" |
25 |
| - return icon .. " " .. (ctx.kind or "") |
26 |
| - end, |
27 |
| - highlight = function(ctx) |
28 |
| - return "CmpItemKind" .. (ctx.kind or "Default") |
29 |
| - end, |
| 5 | + version = "*", |
| 6 | + ---@module 'blink.cmp' |
| 7 | + ---@type blink.cmp.Config |
| 8 | + config = function() |
| 9 | + local neokinds = require "neokinds" |
| 10 | + |
| 11 | + require("blink-cmp").setup { |
| 12 | + completion = { |
| 13 | + -- TODO: fix this |
| 14 | + -- this block of code for some reason is breaking the whole plugin |
| 15 | + --list = { |
| 16 | + -- selection = { |
| 17 | + -- preselect = true, |
| 18 | + -- auto_insert = false, |
| 19 | + -- }, |
| 20 | + -- }, |
| 21 | + menu = { |
| 22 | + border = "rounded", |
| 23 | + winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", |
| 24 | + draw = { |
| 25 | + components = { |
| 26 | + label = { |
| 27 | + text = require("colorful-menu").blink_components_text, |
| 28 | + highlight = require("colorful-menu").blink_components_highlight, |
| 29 | + }, |
| 30 | + kind_icon = { |
| 31 | + text = function(ctx) |
| 32 | + local icon = neokinds.config.completion_kinds[ctx.kind] or "" |
| 33 | + return icon .. " " .. (ctx.kind or "") |
| 34 | + end, |
| 35 | + highlight = function(ctx) |
| 36 | + return "CmpItemKind" .. (ctx.kind or "Default") |
| 37 | + end, |
| 38 | + }, |
| 39 | + }, |
30 | 40 | },
|
31 | 41 | },
|
32 | 42 | },
|
33 |
| - }, |
34 |
| - }, |
35 |
| - keymap = { |
36 |
| - preset = "enter", |
| 43 | + keymap = { |
| 44 | + preset = "enter", |
37 | 45 |
|
38 |
| - ["<Up>"] = { "select_prev", "fallback" }, |
39 |
| - ["<Down>"] = { "select_next", "fallback" }, |
| 46 | + ["<Up>"] = { "select_prev", "fallback" }, |
| 47 | + ["<Down>"] = { "select_next", "fallback" }, |
40 | 48 |
|
41 |
| - ["<C-space>"] = { |
42 |
| - function(cmp) |
43 |
| - cmp.show { providers = { "snippets" } } |
44 |
| - end, |
45 |
| - }, |
46 |
| - ["<C-y>"] = { "select_and_accept" }, |
47 |
| - ["<C-e>"] = { "hide" }, |
| 49 | + ["<C-space>"] = { |
| 50 | + function(cmp) |
| 51 | + cmp.show { providers = { "snippets" } } |
| 52 | + end, |
| 53 | + }, |
| 54 | + ["<C-y>"] = { "select_and_accept" }, |
| 55 | + ["<C-e>"] = { "hide" }, |
48 | 56 |
|
49 |
| - ["<C-n>"] = { "select_next", "fallback" }, |
50 |
| - ["<C-p>"] = { "select_prev", "fallback" }, |
| 57 | + ["<C-n>"] = { "select_next", "fallback" }, |
| 58 | + ["<C-p>"] = { "select_prev", "fallback" }, |
51 | 59 |
|
52 |
| - ["<C-b>"] = { "scroll_documentation_up", "fallback" }, |
53 |
| - ["<C-f>"] = { "scroll_documentation_down", "fallback" }, |
| 60 | + ["<C-b>"] = { "scroll_documentation_up", "fallback" }, |
| 61 | + ["<C-f>"] = { "scroll_documentation_down", "fallback" }, |
54 | 62 |
|
55 |
| - ["<Tab>"] = { "snippet_forward", "fallback" }, |
56 |
| - ["<S-Tab>"] = { "snippet_backward", "fallback" }, |
57 |
| - }, |
| 63 | + ["<Tab>"] = { "snippet_forward", "fallback" }, |
| 64 | + ["<S-Tab>"] = { "snippet_backward", "fallback" }, |
| 65 | + }, |
58 | 66 |
|
59 |
| - appearance = { |
60 |
| - use_nvim_cmp_as_default = true, |
61 |
| - nerd_font_variant = "mono", |
62 |
| - use_nvim_cmp_as_default = true, |
63 |
| - }, |
64 |
| - snippets = { |
65 |
| - expand = function(snippet) |
66 |
| - require("luasnip").lsp_expand(snippet) |
67 |
| - end, |
68 |
| - active = function(filter) |
69 |
| - if filter and filter.direction then |
70 |
| - return require("luasnip").jumpable(filter.direction) |
71 |
| - end |
72 |
| - return require("luasnip").in_snippet() |
73 |
| - end, |
74 |
| - jump = function(direction) |
75 |
| - require("luasnip").jump(direction) |
76 |
| - end, |
77 |
| - }, |
| 67 | + appearance = { |
| 68 | + use_nvim_cmp_as_default = true, |
| 69 | + nerd_font_variant = "mono", |
| 70 | + use_nvim_cmp_as_default = true, |
| 71 | + }, |
| 72 | + snippets = { |
| 73 | + expand = function(snippet) |
| 74 | + require("luasnip").lsp_expand(snippet) |
| 75 | + end, |
| 76 | + active = function(filter) |
| 77 | + if filter and filter.direction then |
| 78 | + return require("luasnip").jumpable(filter.direction) |
| 79 | + end |
| 80 | + return require("luasnip").in_snippet() |
| 81 | + end, |
| 82 | + jump = function(direction) |
| 83 | + require("luasnip").jump(direction) |
| 84 | + end, |
| 85 | + }, |
78 | 86 |
|
79 |
| - sources = { |
80 |
| - default = { "lsp", "path", "snippets", "buffer" }, |
81 |
| - cmdline = {}, |
82 |
| - }, |
83 |
| - -- opts_extend = { "sources.default" }, |
| 87 | + sources = { |
| 88 | + default = { "lsp", "path", "snippets", "buffer" }, |
| 89 | + cmdline = {}, |
| 90 | + }, |
| 91 | + -- opts_extend = { "sources.default" }, |
| 92 | + } |
| 93 | + end, |
84 | 94 | }
|
0 commit comments