@@ -482,8 +482,8 @@ require('lazy').setup({
482482 -- Useful status updates for LSP.
483483 { ' j-hui/fidget.nvim' , opts = {} },
484484
485- -- Allows extra capabilities provided by nvim- cmp
486- ' hrsh7th/ cmp-nvim-lsp ' ,
485+ -- Allows extra capabilities provided by blink. cmp
486+ ' saghen/blink. cmp' ,
487487 },
488488 config = function ()
489489 -- Brief aside: **What is LSP?**
@@ -650,10 +650,9 @@ require('lazy').setup({
650650
651651 -- LSP servers and clients are able to communicate to each other what features they support.
652652 -- By default, Neovim doesn't support everything that is in the LSP specification.
653- -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
654- -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
655- local capabilities = vim .lsp .protocol .make_client_capabilities ()
656- capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
653+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
654+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
655+ local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
657656
658657 -- Enable the following language servers
659658 -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -772,12 +771,14 @@ require('lazy').setup({
772771 },
773772
774773 { -- Autocompletion
775- ' hrsh7th/nvim-cmp' ,
776- event = ' InsertEnter' ,
774+ ' saghen/blink.cmp' ,
775+ event = ' VimEnter' ,
776+ version = ' 1.*' ,
777777 dependencies = {
778- -- Snippet Engine & its associated nvim-cmp source
778+ -- Snippet Engine
779779 {
780780 ' L3MON4D3/LuaSnip' ,
781+ version = ' 2.*' ,
781782 build = (function ()
782783 -- Build Step is needed for regex support in snippets.
783784 -- This step is not supported in many windows environments.
@@ -798,95 +799,74 @@ require('lazy').setup({
798799 -- end,
799800 -- },
800801 },
802+ opts = {},
801803 },
802- ' saadparwaiz1/cmp_luasnip' ,
803-
804- -- Adds other completion capabilities.
805- -- nvim-cmp does not ship with all sources by default. They are split
806- -- into multiple repos for maintenance purposes.
807- ' hrsh7th/cmp-nvim-lsp' ,
808- ' hrsh7th/cmp-path' ,
809- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
804+ ' folke/lazydev.nvim' ,
810805 },
811- config = function ()
812- -- See `:help cmp`
813- local cmp = require ' cmp'
814- local luasnip = require ' luasnip'
815- luasnip .config .setup {}
816-
817- cmp .setup {
818- snippet = {
819- expand = function (args )
820- luasnip .lsp_expand (args .body )
821- end ,
822- },
823- completion = { completeopt = ' menu,menuone,noinsert' },
824-
825- -- For an understanding of why these mappings were
826- -- chosen, you will need to read `:help ins-completion`
806+ --- @module ' blink.cmp'
807+ --- @type blink.cmp.Config
808+ opts = {
809+ keymap = {
810+ -- 'default' (recommended) for mappings similar to built-in completions
811+ -- <c-y> to accept ([y]es) the completion.
812+ -- This will auto-import if your LSP supports it.
813+ -- This will expand snippets if the LSP sent a snippet.
814+ -- 'super-tab' for tab to accept
815+ -- 'enter' for enter to accept
816+ -- 'none' for no mappings
817+ --
818+ -- For an understanding of why the 'default' preset is recommended,
819+ -- you will need to read `:help ins-completion`
827820 --
828821 -- No, but seriously. Please read `:help ins-completion`, it is really good!
829- mapping = cmp .mapping .preset .insert {
830- -- Select the [n]ext item
831- [' <C-n>' ] = cmp .mapping .select_next_item (),
832- -- Select the [p]revious item
833- [' <C-p>' ] = cmp .mapping .select_prev_item (),
834-
835- -- Scroll the documentation window [b]ack / [f]orward
836- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
837- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
838-
839- -- Accept ([y]es) the completion.
840- -- This will auto-import if your LSP supports it.
841- -- This will expand snippets if the LSP sent a snippet.
842- [' <C-y>' ] = cmp .mapping .confirm { select = true },
843-
844- -- If you prefer more traditional completion keymaps,
845- -- you can uncomment the following lines
846- -- ['<CR>'] = cmp.mapping.confirm { select = true },
847- -- ['<Tab>'] = cmp.mapping.select_next_item(),
848- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
849-
850- -- Manually trigger a completion from nvim-cmp.
851- -- Generally you don't need this, because nvim-cmp will display
852- -- completions whenever it has completion options available.
853- [' <C-Space>' ] = cmp .mapping .complete {},
854-
855- -- Think of <c-l> as moving to the right of your snippet expansion.
856- -- So if you have a snippet that's like:
857- -- function $name($args)
858- -- $body
859- -- end
860- --
861- -- <c-l> will move you to the right of each of the expansion locations.
862- -- <c-h> is similar, except moving you backwards.
863- [' <C-l>' ] = cmp .mapping (function ()
864- if luasnip .expand_or_locally_jumpable () then
865- luasnip .expand_or_jump ()
866- end
867- end , { ' i' , ' s' }),
868- [' <C-h>' ] = cmp .mapping (function ()
869- if luasnip .locally_jumpable (- 1 ) then
870- luasnip .jump (- 1 )
871- end
872- end , { ' i' , ' s' }),
822+ --
823+ -- All presets have the following mappings:
824+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
825+ -- <c-space>: Open menu or open docs if already open
826+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
827+ -- <c-e>: Hide menu
828+ -- <c-k>: Toggle signature help
829+ --
830+ -- See :h blink-cmp-config-keymap for defining your own keymap
831+ preset = ' default' ,
873832
874- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
875- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
876- },
877- sources = {
878- {
879- name = ' lazydev' ,
880- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
881- group_index = 0 ,
882- },
883- { name = ' nvim_lsp' },
884- { name = ' luasnip' },
885- { name = ' path' },
886- { name = ' nvim_lsp_signature_help' },
833+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
834+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
835+ },
836+
837+ appearance = {
838+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
839+ -- Adjusts spacing to ensure icons are aligned
840+ nerd_font_variant = ' mono' ,
841+ },
842+
843+ completion = {
844+ -- By default, you may press `<c-space>` to show the documentation.
845+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
846+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
847+ },
848+
849+ sources = {
850+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
851+ providers = {
852+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
887853 },
888- }
889- end ,
854+ },
855+
856+ snippets = { preset = ' luasnip' },
857+
858+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
859+ -- which automatically downloads a prebuilt binary when enabled.
860+ --
861+ -- By default, we use the Lua implementation instead, but you may enable
862+ -- the rust implementation via `'prefer_rust_with_warning'`
863+ --
864+ -- See :h blink-cmp-config-fuzzy for more information
865+ fuzzy = { implementation = ' lua' },
866+
867+ -- Shows a signature help window while you type arguments for a function
868+ signature = { enabled = true },
869+ },
890870 },
891871
892872 {
0 commit comments