@@ -226,8 +226,8 @@ require('lazy').setup({
226226 -- Useful status updates for LSP.
227227 { ' j-hui/fidget.nvim' , opts = {} },
228228
229- -- Allows extra capabilities provided by nvim- cmp
230- ' hrsh7th/ cmp-nvim-lsp ' ,
229+ -- Allows extra capabilities provided by blink. cmp
230+ ' saghen/blink. cmp' ,
231231 },
232232 config = function ()
233233 -- Brief aside: **What is LSP?**
@@ -317,10 +317,9 @@ require('lazy').setup({
317317
318318 -- LSP servers and clients are able to communicate to each other what features they support.
319319 -- By default, Neovim doesn't support everything that is in the LSP specification.
320- -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
321- -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
322- local capabilities = vim .lsp .protocol .make_client_capabilities ()
323- capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
320+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
321+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
322+ local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
324323
325324 require (' lspconfig' ).clangd .setup {}
326325 require (' lspconfig' ).rust_analyzer .setup {
@@ -382,12 +381,14 @@ require('lazy').setup({
382381 },
383382
384383 { -- Autocompletion
385- ' hrsh7th/nvim-cmp' ,
386- event = ' InsertEnter' ,
384+ ' saghen/blink.cmp' ,
385+ event = ' VimEnter' ,
386+ version = ' 1.*' ,
387387 dependencies = {
388- -- Snippet Engine & its associated nvim-cmp source
388+ -- Snippet Engine
389389 {
390390 ' L3MON4D3/LuaSnip' ,
391+ version = ' 2.*' ,
391392 build = (function ()
392393 -- Build Step is needed for regex support in snippets.
393394 -- This step is not supported in many windows environments.
@@ -408,95 +409,74 @@ require('lazy').setup({
408409 -- end,
409410 -- },
410411 },
412+ opts = {},
411413 },
412- ' saadparwaiz1/cmp_luasnip' ,
413-
414- -- Adds other completion capabilities.
415- -- nvim-cmp does not ship with all sources by default. They are split
416- -- into multiple repos for maintenance purposes.
417- ' hrsh7th/cmp-nvim-lsp' ,
418- ' hrsh7th/cmp-path' ,
419- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
414+ ' folke/lazydev.nvim' ,
420415 },
421- config = function ()
422- -- See `:help cmp`
423- local cmp = require ' cmp'
424- local luasnip = require ' luasnip'
425- luasnip .config .setup {}
426-
427- cmp .setup {
428- snippet = {
429- expand = function (args )
430- luasnip .lsp_expand (args .body )
431- end ,
432- },
433- completion = { completeopt = ' menu,menuone,noinsert' },
434-
435- -- For an understanding of why these mappings were
436- -- chosen, you will need to read `:help ins-completion`
416+ --- @module ' blink.cmp'
417+ --- @type blink.cmp.Config
418+ opts = {
419+ keymap = {
420+ -- 'default' (recommended) for mappings similar to built-in completions
421+ -- <c-y> to accept ([y]es) the completion.
422+ -- This will auto-import if your LSP supports it.
423+ -- This will expand snippets if the LSP sent a snippet.
424+ -- 'super-tab' for tab to accept
425+ -- 'enter' for enter to accept
426+ -- 'none' for no mappings
427+ --
428+ -- For an understanding of why the 'default' preset is recommended,
429+ -- you will need to read `:help ins-completion`
437430 --
438431 -- No, but seriously. Please read `:help ins-completion`, it is really good!
439- mapping = cmp .mapping .preset .insert {
440- -- Select the [n]ext item
441- [' <C-n>' ] = cmp .mapping .select_next_item (),
442- -- Select the [p]revious item
443- [' <C-p>' ] = cmp .mapping .select_prev_item (),
444-
445- -- Scroll the documentation window [b]ack / [f]orward
446- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
447- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
448-
449- -- Accept ([y]es) the completion.
450- -- This will auto-import if your LSP supports it.
451- -- This will expand snippets if the LSP sent a snippet.
452- [' <C-y>' ] = cmp .mapping .confirm { select = true },
453-
454- -- If you prefer more traditional completion keymaps,
455- -- you can uncomment the following lines
456- -- ['<CR>'] = cmp.mapping.confirm { select = true },
457- -- ['<Tab>'] = cmp.mapping.select_next_item(),
458- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
459-
460- -- Manually trigger a completion from nvim-cmp.
461- -- Generally you don't need this, because nvim-cmp will display
462- -- completions whenever it has completion options available.
463- [' <C-Space>' ] = cmp .mapping .complete {},
464-
465- -- Think of <c-l> as moving to the right of your snippet expansion.
466- -- So if you have a snippet that's like:
467- -- function $name($args)
468- -- $body
469- -- end
470- --
471- -- <c-l> will move you to the right of each of the expansion locations.
472- -- <c-h> is similar, except moving you backwards.
473- [' <C-l>' ] = cmp .mapping (function ()
474- if luasnip .expand_or_locally_jumpable () then
475- luasnip .expand_or_jump ()
476- end
477- end , { ' i' , ' s' }),
478- [' <C-h>' ] = cmp .mapping (function ()
479- if luasnip .locally_jumpable (- 1 ) then
480- luasnip .jump (- 1 )
481- end
482- end , { ' i' , ' s' }),
483-
484- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
485- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
486- },
487- sources = {
488- {
489- name = ' lazydev' ,
490- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
491- group_index = 0 ,
492- },
493- { name = ' nvim_lsp' },
494- { name = ' luasnip' },
495- { name = ' path' },
496- { name = ' nvim_lsp_signature_help' },
432+ --
433+ -- All presets have the following mappings:
434+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
435+ -- <c-space>: Open menu or open docs if already open
436+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
437+ -- <c-e>: Hide menu
438+ -- <c-k>: Toggle signature help
439+ --
440+ -- See :h blink-cmp-config-keymap for defining your own keymap
441+ preset = ' default' ,
442+
443+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
444+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
445+ },
446+
447+ appearance = {
448+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
449+ -- Adjusts spacing to ensure icons are aligned
450+ nerd_font_variant = ' mono' ,
451+ },
452+
453+ completion = {
454+ -- By default, you may press `<c-space>` to show the documentation.
455+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
456+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
457+ },
458+
459+ sources = {
460+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
461+ providers = {
462+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
497463 },
498- }
499- end ,
464+ },
465+
466+ snippets = { preset = ' luasnip' },
467+
468+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
469+ -- which automatically downloads a prebuilt binary when enabled.
470+ --
471+ -- By default, we use the Lua implementation instead, but you may enable
472+ -- the rust implementation via `'prefer_rust_with_warning'`
473+ --
474+ -- See :h blink-cmp-config-fuzzy for more information
475+ fuzzy = { implementation = ' lua' },
476+
477+ -- Shows a signature help window while you type arguments for a function
478+ signature = { enabled = true },
479+ },
500480 },
501481
502482 -- Highlight todo, notes, etc in comments
0 commit comments