@@ -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.
@@ -796,12 +795,14 @@ require('lazy').setup({
796795 },
797796
798797 { -- Autocompletion
799- ' hrsh7th/nvim-cmp' ,
800- event = ' InsertEnter' ,
798+ ' saghen/blink.cmp' ,
799+ event = ' VimEnter' ,
800+ version = ' 1.*' ,
801801 dependencies = {
802- -- Snippet Engine & its associated nvim-cmp source
802+ -- Snippet Engine
803803 {
804804 ' L3MON4D3/LuaSnip' ,
805+ version = ' 2.*' ,
805806 build = (function ()
806807 -- Build Step is needed for regex support in snippets.
807808 -- This step is not supported in many windows environments.
@@ -822,95 +823,74 @@ require('lazy').setup({
822823 -- end,
823824 -- },
824825 },
826+ opts = {},
825827 },
826- ' saadparwaiz1/cmp_luasnip' ,
827-
828- -- Adds other completion capabilities.
829- -- nvim-cmp does not ship with all sources by default. They are split
830- -- into multiple repos for maintenance purposes.
831- ' hrsh7th/cmp-nvim-lsp' ,
832- ' hrsh7th/cmp-path' ,
833- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
828+ ' folke/lazydev.nvim' ,
834829 },
835- config = function ()
836- -- See `:help cmp`
837- local cmp = require ' cmp'
838- local luasnip = require ' luasnip'
839- luasnip .config .setup {}
840-
841- cmp .setup {
842- snippet = {
843- expand = function (args )
844- luasnip .lsp_expand (args .body )
845- end ,
846- },
847- completion = { completeopt = ' menu,menuone,noinsert' },
848-
849- -- For an understanding of why these mappings were
850- -- chosen, you will need to read `:help ins-completion`
830+ --- @module ' blink.cmp'
831+ --- @type blink.cmp.Config
832+ opts = {
833+ keymap = {
834+ -- 'default' (recommended) for mappings similar to built-in completions
835+ -- <c-y> to accept ([y]es) the completion.
836+ -- This will auto-import if your LSP supports it.
837+ -- This will expand snippets if the LSP sent a snippet.
838+ -- 'super-tab' for tab to accept
839+ -- 'enter' for enter to accept
840+ -- 'none' for no mappings
841+ --
842+ -- For an understanding of why the 'default' preset is recommended,
843+ -- you will need to read `:help ins-completion`
851844 --
852845 -- No, but seriously. Please read `:help ins-completion`, it is really good!
853- mapping = cmp .mapping .preset .insert {
854- -- Select the [n]ext item
855- [' <C-n>' ] = cmp .mapping .select_next_item (),
856- -- Select the [p]revious item
857- [' <C-p>' ] = cmp .mapping .select_prev_item (),
858-
859- -- Scroll the documentation window [b]ack / [f]orward
860- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
861- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
862-
863- -- Accept ([y]es) the completion.
864- -- This will auto-import if your LSP supports it.
865- -- This will expand snippets if the LSP sent a snippet.
866- [' <C-y>' ] = cmp .mapping .confirm { select = true },
867-
868- -- If you prefer more traditional completion keymaps,
869- -- you can uncomment the following lines
870- -- ['<CR>'] = cmp.mapping.confirm { select = true },
871- -- ['<Tab>'] = cmp.mapping.select_next_item(),
872- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
873-
874- -- Manually trigger a completion from nvim-cmp.
875- -- Generally you don't need this, because nvim-cmp will display
876- -- completions whenever it has completion options available.
877- [' <C-Space>' ] = cmp .mapping .complete {},
878-
879- -- Think of <c-l> as moving to the right of your snippet expansion.
880- -- So if you have a snippet that's like:
881- -- function $name($args)
882- -- $body
883- -- end
884- --
885- -- <c-l> will move you to the right of each of the expansion locations.
886- -- <c-h> is similar, except moving you backwards.
887- [' <C-l>' ] = cmp .mapping (function ()
888- if luasnip .expand_or_locally_jumpable () then
889- luasnip .expand_or_jump ()
890- end
891- end , { ' i' , ' s' }),
892- [' <C-h>' ] = cmp .mapping (function ()
893- if luasnip .locally_jumpable (- 1 ) then
894- luasnip .jump (- 1 )
895- end
896- end , { ' i' , ' s' }),
846+ --
847+ -- All presets have the following mappings:
848+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
849+ -- <c-space>: Open menu or open docs if already open
850+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
851+ -- <c-e>: Hide menu
852+ -- <c-k>: Toggle signature help
853+ --
854+ -- See :h blink-cmp-config-keymap for defining your own keymap
855+ preset = ' default' ,
897856
898- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
899- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
900- },
901- sources = {
902- {
903- name = ' lazydev' ,
904- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
905- group_index = 0 ,
906- },
907- { name = ' nvim_lsp' },
908- { name = ' luasnip' },
909- { name = ' path' },
910- { name = ' nvim_lsp_signature_help' },
857+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
858+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
859+ },
860+
861+ appearance = {
862+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
863+ -- Adjusts spacing to ensure icons are aligned
864+ nerd_font_variant = ' mono' ,
865+ },
866+
867+ completion = {
868+ -- By default, you may press `<c-space>` to show the documentation.
869+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
870+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
871+ },
872+
873+ sources = {
874+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
875+ providers = {
876+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
911877 },
912- }
913- end ,
878+ },
879+
880+ snippets = { preset = ' luasnip' },
881+
882+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
883+ -- which automatically downloads a prebuilt binary when enabled.
884+ --
885+ -- By default, we use the Lua implementation instead, but you may enable
886+ -- the rust implementation via `'prefer_rust_with_warning'`
887+ --
888+ -- See :h blink-cmp-config-fuzzy for more information
889+ fuzzy = { implementation = ' lua' },
890+
891+ -- Shows a signature help window while you type arguments for a function
892+ signature = { enabled = true },
893+ },
914894 },
915895
916896 { -- You can easily change to a different colorscheme.
0 commit comments