@@ -500,8 +500,8 @@ require('lazy').setup({
500500 -- Useful status updates for LSP.
501501 { ' j-hui/fidget.nvim' , opts = {} },
502502
503- -- Allows extra capabilities provided by nvim- cmp
504- ' hrsh7th/ cmp-nvim-lsp ' ,
503+ -- Allows extra capabilities provided by blink. cmp
504+ ' saghen/blink. cmp' ,
505505 },
506506 config = function ()
507507 -- Brief aside: **What is LSP?**
@@ -668,10 +668,9 @@ require('lazy').setup({
668668
669669 -- LSP servers and clients are able to communicate to each other what features they support.
670670 -- By default, Neovim doesn't support everything that is in the LSP specification.
671- -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
672- -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
673- local capabilities = vim .lsp .protocol .make_client_capabilities ()
674- capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
671+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
672+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
673+ local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
675674
676675 -- Enable the following language servers
677676 -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -792,12 +791,14 @@ require('lazy').setup({
792791 },
793792
794793 { -- Autocompletion
795- ' hrsh7th/nvim-cmp' ,
796- event = ' InsertEnter' ,
794+ ' saghen/blink.cmp' ,
795+ event = ' VimEnter' ,
796+ version = ' 1.*' ,
797797 dependencies = {
798- -- Snippet Engine & its associated nvim-cmp source
798+ -- Snippet Engine
799799 {
800800 ' L3MON4D3/LuaSnip' ,
801+ version = ' 2.*' ,
801802 build = (function ()
802803 -- Build Step is needed for regex support in snippets.
803804 -- This step is not supported in many windows environments.
@@ -818,95 +819,74 @@ require('lazy').setup({
818819 -- end,
819820 -- },
820821 },
822+ opts = {},
821823 },
822- ' saadparwaiz1/cmp_luasnip' ,
823-
824- -- Adds other completion capabilities.
825- -- nvim-cmp does not ship with all sources by default. They are split
826- -- into multiple repos for maintenance purposes.
827- ' hrsh7th/cmp-nvim-lsp' ,
828- ' hrsh7th/cmp-path' ,
829- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
824+ ' folke/lazydev.nvim' ,
830825 },
831- config = function ()
832- -- See `:help cmp`
833- local cmp = require ' cmp'
834- local luasnip = require ' luasnip'
835- luasnip .config .setup {}
836-
837- cmp .setup {
838- snippet = {
839- expand = function (args )
840- luasnip .lsp_expand (args .body )
841- end ,
842- },
843- completion = { completeopt = ' menu,menuone,noinsert' },
844-
845- -- For an understanding of why these mappings were
846- -- chosen, you will need to read `:help ins-completion`
826+ --- @module ' blink.cmp'
827+ --- @type blink.cmp.Config
828+ opts = {
829+ keymap = {
830+ -- 'default' (recommended) for mappings similar to built-in completions
831+ -- <c-y> to accept ([y]es) the completion.
832+ -- This will auto-import if your LSP supports it.
833+ -- This will expand snippets if the LSP sent a snippet.
834+ -- 'super-tab' for tab to accept
835+ -- 'enter' for enter to accept
836+ -- 'none' for no mappings
837+ --
838+ -- For an understanding of why the 'default' preset is recommended,
839+ -- you will need to read `:help ins-completion`
847840 --
848841 -- No, but seriously. Please read `:help ins-completion`, it is really good!
849- mapping = cmp .mapping .preset .insert {
850- -- Select the [n]ext item
851- [' <C-n>' ] = cmp .mapping .select_next_item (),
852- -- Select the [p]revious item
853- [' <C-p>' ] = cmp .mapping .select_prev_item (),
854-
855- -- Scroll the documentation window [b]ack / [f]orward
856- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
857- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
858-
859- -- Accept ([y]es) the completion.
860- -- This will auto-import if your LSP supports it.
861- -- This will expand snippets if the LSP sent a snippet.
862- [' <C-y>' ] = cmp .mapping .confirm { select = true },
863-
864- -- If you prefer more traditional completion keymaps,
865- -- you can uncomment the following lines
866- -- ['<CR>'] = cmp.mapping.confirm { select = true },
867- -- ['<Tab>'] = cmp.mapping.select_next_item(),
868- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
869-
870- -- Manually trigger a completion from nvim-cmp.
871- -- Generally you don't need this, because nvim-cmp will display
872- -- completions whenever it has completion options available.
873- [' <C-Space>' ] = cmp .mapping .complete {},
874-
875- -- Think of <c-l> as moving to the right of your snippet expansion.
876- -- So if you have a snippet that's like:
877- -- function $name($args)
878- -- $body
879- -- end
880- --
881- -- <c-l> will move you to the right of each of the expansion locations.
882- -- <c-h> is similar, except moving you backwards.
883- [' <C-l>' ] = cmp .mapping (function ()
884- if luasnip .expand_or_locally_jumpable () then
885- luasnip .expand_or_jump ()
886- end
887- end , { ' i' , ' s' }),
888- [' <C-h>' ] = cmp .mapping (function ()
889- if luasnip .locally_jumpable (- 1 ) then
890- luasnip .jump (- 1 )
891- end
892- end , { ' i' , ' s' }),
842+ --
843+ -- All presets have the following mappings:
844+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
845+ -- <c-space>: Open menu or open docs if already open
846+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
847+ -- <c-e>: Hide menu
848+ -- <c-k>: Toggle signature help
849+ --
850+ -- See :h blink-cmp-config-keymap for defining your own keymap
851+ preset = ' default' ,
893852
894- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
895- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
896- },
897- sources = {
898- {
899- name = ' lazydev' ,
900- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
901- group_index = 0 ,
902- },
903- { name = ' nvim_lsp' },
904- { name = ' luasnip' },
905- { name = ' path' },
906- { name = ' nvim_lsp_signature_help' },
853+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
854+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
855+ },
856+
857+ appearance = {
858+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
859+ -- Adjusts spacing to ensure icons are aligned
860+ nerd_font_variant = ' mono' ,
861+ },
862+
863+ completion = {
864+ -- By default, you may press `<c-space>` to show the documentation.
865+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
866+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
867+ },
868+
869+ sources = {
870+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
871+ providers = {
872+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
907873 },
908- }
909- end ,
874+ },
875+
876+ snippets = { preset = ' luasnip' },
877+
878+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
879+ -- which automatically downloads a prebuilt binary when enabled.
880+ --
881+ -- By default, we use the Lua implementation instead, but you may enable
882+ -- the rust implementation via `'prefer_rust_with_warning'`
883+ --
884+ -- See :h blink-cmp-config-fuzzy for more information
885+ fuzzy = { implementation = ' lua' },
886+
887+ -- Shows a signature help window while you type arguments for a function
888+ signature = { enabled = true },
889+ },
910890 },
911891
912892 { -- You can easily change to a different colorscheme.
0 commit comments