|
| 1 | +return { |
| 2 | + { -- Autocompletion |
| 3 | + 'saghen/blink.cmp', |
| 4 | + event = 'VimEnter', |
| 5 | + version = '1.*', |
| 6 | + dependencies = { |
| 7 | + -- Snippet Engine |
| 8 | + { |
| 9 | + 'L3MON4D3/LuaSnip', |
| 10 | + version = '2.*', |
| 11 | + build = (function() |
| 12 | + -- Build Step is needed for regex support in snippets. |
| 13 | + -- This step is not supported in many windows environments. |
| 14 | + -- Remove the below condition to re-enable on windows. |
| 15 | + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then |
| 16 | + return |
| 17 | + end |
| 18 | + return 'make install_jsregexp' |
| 19 | + end)(), |
| 20 | + dependencies = { |
| 21 | + -- `friendly-snippets` contains a variety of premade snippets. |
| 22 | + -- See the README about individual language/framework/plugin snippets: |
| 23 | + -- https://github.com/rafamadriz/friendly-snippets |
| 24 | + { |
| 25 | + 'rafamadriz/friendly-snippets', |
| 26 | + config = function() |
| 27 | + require('luasnip.loaders.from_vscode').lazy_load() |
| 28 | + end, |
| 29 | + }, |
| 30 | + }, |
| 31 | + opts = {}, |
| 32 | + }, |
| 33 | + 'folke/lazydev.nvim', |
| 34 | + }, |
| 35 | + --- @module 'blink.cmp' |
| 36 | + --- @type blink.cmp.Config |
| 37 | + opts = { |
| 38 | + keymap = { |
| 39 | + -- 'default' (recommended) for mappings similar to built-in completions |
| 40 | + -- <c-y> to accept ([y]es) the completion. |
| 41 | + -- This will auto-import if your LSP supports it. |
| 42 | + -- This will expand snippets if the LSP sent a snippet. |
| 43 | + -- 'super-tab' for tab to accept |
| 44 | + -- 'enter' for enter to accept |
| 45 | + -- 'none' for no mappings |
| 46 | + -- |
| 47 | + -- For an understanding of why the 'default' preset is recommended, |
| 48 | + -- you will need to read `:help ins-completion` |
| 49 | + -- |
| 50 | + -- No, but seriously. Please read `:help ins-completion`, it is really good! |
| 51 | + -- |
| 52 | + -- All presets have the following mappings: |
| 53 | + -- <tab>/<s-tab>: move to right/left of your snippet expansion |
| 54 | + -- <c-space>: Open menu or open docs if already open |
| 55 | + -- <c-n>/<c-p> or <up>/<down>: Select next/previous item |
| 56 | + -- <c-e>: Hide menu |
| 57 | + -- <c-k>: Toggle signature help |
| 58 | + -- |
| 59 | + -- See :h blink-cmp-config-keymap for defining your own keymap |
| 60 | + preset = 'default', |
| 61 | + |
| 62 | + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: |
| 63 | + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps |
| 64 | + }, |
| 65 | + |
| 66 | + appearance = { |
| 67 | + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' |
| 68 | + -- Adjusts spacing to ensure icons are aligned |
| 69 | + nerd_font_variant = 'mono', |
| 70 | + }, |
| 71 | + |
| 72 | + completion = { |
| 73 | + -- By default, you may press `<c-space>` to show the documentation. |
| 74 | + -- Optionally, set `auto_show = true` to show the documentation after a delay. |
| 75 | + documentation = { auto_show = true, auto_show_delay_ms = 500 }, |
| 76 | + menu = { |
| 77 | + draw = { |
| 78 | + columns = { |
| 79 | + { 'kind_icon', 'label', 'label_description', gap = 1 }, |
| 80 | + { 'kind' }, |
| 81 | + }, |
| 82 | + }, |
| 83 | + }, |
| 84 | + }, |
| 85 | + |
| 86 | + sources = { |
| 87 | + default = { 'lsp', 'path', 'snippets', 'lazydev' }, |
| 88 | + providers = { |
| 89 | + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, |
| 90 | + }, |
| 91 | + }, |
| 92 | + |
| 93 | + snippets = { preset = 'luasnip' }, |
| 94 | + |
| 95 | + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, |
| 96 | + -- which automatically downloads a prebuilt binary when enabled. |
| 97 | + -- |
| 98 | + -- By default, we use the Lua implementation instead, but you may enable |
| 99 | + -- the rust implementation via `'prefer_rust_with_warning'` |
| 100 | + -- |
| 101 | + -- See :h blink-cmp-config-fuzzy for more information |
| 102 | + fuzzy = { implementation = 'prefer_rust_with_warning' }, |
| 103 | + |
| 104 | + -- Shows a signature help window while you type arguments for a function |
| 105 | + signature = { enabled = true }, |
| 106 | + }, |
| 107 | + }, |
| 108 | +} |
0 commit comments