@@ -368,12 +368,14 @@ require('lazy').setup({
368368 { ' Bilal2453/luvit-meta' , lazy = true },
369369 require ' custom.plugins.mason' ,
370370 { -- Autocompletion
371- ' hrsh7th/nvim-cmp' ,
372- event = ' InsertEnter' ,
371+ ' saghen/blink.cmp' ,
372+ event = ' VimEnter' ,
373+ version = ' 1.*' ,
373374 dependencies = {
374- -- Snippet Engine & its associated nvim-cmp source
375+ -- Snippet Engine
375376 {
376377 ' L3MON4D3/LuaSnip' ,
378+ version = ' 2.*' ,
377379 build = (function ()
378380 -- Build Step is needed for regex support in snippets.
379381 -- This step is not supported in many windows environments.
@@ -394,95 +396,74 @@ require('lazy').setup({
394396 end ,
395397 },
396398 },
399+ opts = {},
397400 },
398- ' saadparwaiz1/cmp_luasnip' ,
399-
400- -- Adds other completion capabilities.
401- -- nvim-cmp does not ship with all sources by default. They are split
402- -- into multiple repos for maintenance purposes.
403- ' hrsh7th/cmp-nvim-lsp' ,
404- ' hrsh7th/cmp-path' ,
405- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
401+ ' folke/lazydev.nvim' ,
406402 },
407- config = function ()
408- -- See `:help cmp`
409- local cmp = require ' cmp'
410- local luasnip = require ' luasnip'
411- luasnip .config .setup {}
412-
413- cmp .setup {
414- snippet = {
415- expand = function (args )
416- luasnip .lsp_expand (args .body )
417- end ,
418- },
419- completion = { completeopt = ' menu,menuone,noinsert' },
420-
421- -- For an understanding of why these mappings were
422- -- chosen, you will need to read `:help ins-completion`
403+ --- @module ' blink.cmp'
404+ --- @type blink.cmp.Config
405+ opts = {
406+ keymap = {
407+ -- 'default' (recommended) for mappings similar to built-in completions
408+ -- <c-y> to accept ([y]es) the completion.
409+ -- This will auto-import if your LSP supports it.
410+ -- This will expand snippets if the LSP sent a snippet.
411+ -- 'super-tab' for tab to accept
412+ -- 'enter' for enter to accept
413+ -- 'none' for no mappings
414+ --
415+ -- For an understanding of why the 'default' preset is recommended,
416+ -- you will need to read `:help ins-completion`
423417 --
424418 -- No, but seriously. Please read `:help ins-completion`, it is really good!
425- mapping = cmp .mapping .preset .insert {
426- -- Select the [n]ext item
427- [' <C-n>' ] = cmp .mapping .select_next_item (),
428- -- Select the [p]revious item
429- [' <C-p>' ] = cmp .mapping .select_prev_item (),
430-
431- -- Scroll the documentation window [b]ack / [f]orward
432- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
433- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
434-
435- -- Accept ([y]es) the completion.
436- -- This will auto-import if your LSP supports it.
437- -- This will expand snippets if the LSP sent a snippet.
438- [' <C-y>' ] = cmp .mapping .confirm { select = true },
439-
440- -- If you prefer more traditional completion keymaps,
441- -- you can uncomment the following lines
442- -- ['<CR>'] = cmp.mapping.confirm { select = true },
443- -- ['<Tab>'] = cmp.mapping.select_next_item(),
444- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
445-
446- -- Manually trigger a completion from nvim-cmp.
447- -- Generally you don't need this, because nvim-cmp will display
448- -- completions whenever it has completion options available.
449- [' <C-Space>' ] = cmp .mapping .complete {},
450-
451- -- Think of <c-l> as moving to the right of your snippet expansion.
452- -- So if you have a snippet that's like:
453- -- function $name($args)
454- -- $body
455- -- end
456- --
457- -- <c-l> will move you to the right of each of the expansion locations.
458- -- <c-h> is similar, except moving you backwards.
459- [' <C-l>' ] = cmp .mapping (function ()
460- if luasnip .expand_or_locally_jumpable () then
461- luasnip .expand_or_jump ()
462- end
463- end , { ' i' , ' s' }),
464- [' <C-h>' ] = cmp .mapping (function ()
465- if luasnip .locally_jumpable (- 1 ) then
466- luasnip .jump (- 1 )
467- end
468- end , { ' i' , ' s' }),
469-
470- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
471- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
472- },
473- sources = {
474- {
475- name = ' lazydev' ,
476- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
477- group_index = 0 ,
478- },
479- { name = ' nvim_lsp' },
480- { name = ' luasnip' },
481- { name = ' path' },
482- { name = ' nvim_lsp_signature_help' },
419+ --
420+ -- All presets have the following mappings:
421+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
422+ -- <c-space>: Open menu or open docs if already open
423+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
424+ -- <c-e>: Hide menu
425+ -- <c-k>: Toggle signature help
426+ --
427+ -- See :h blink-cmp-config-keymap for defining your own keymap
428+ preset = ' default' ,
429+
430+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
431+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
432+ },
433+
434+ appearance = {
435+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
436+ -- Adjusts spacing to ensure icons are aligned
437+ nerd_font_variant = ' mono' ,
438+ },
439+
440+ completion = {
441+ -- By default, you may press `<c-space>` to show the documentation.
442+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
443+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
444+ },
445+
446+ sources = {
447+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
448+ providers = {
449+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
483450 },
484- }
485- end ,
451+ },
452+
453+ snippets = { preset = ' luasnip' },
454+
455+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
456+ -- which automatically downloads a prebuilt binary when enabled.
457+ --
458+ -- By default, we use the Lua implementation instead, but you may enable
459+ -- the rust implementation via `'prefer_rust_with_warning'`
460+ --
461+ -- See :h blink-cmp-config-fuzzy for more information
462+ fuzzy = { implementation = ' lua' },
463+
464+ -- Shows a signature help window while you type arguments for a function
465+ signature = { enabled = true },
466+ },
486467 },
487468
488469 { -- You can easily change to a different colorscheme.
0 commit comments