@@ -530,8 +530,8 @@ require('lazy').setup({
530530 -- Useful status updates for LSP.
531531 { ' j-hui/fidget.nvim' , opts = {} },
532532
533- -- Allows extra capabilities provided by nvim- cmp
534- ' hrsh7th/ cmp-nvim-lsp ' ,
533+ -- Allows extra capabilities provided by blink. cmp
534+ ' saghen/blink. cmp' ,
535535 },
536536 config = function ()
537537 -- Brief aside: **What is LSP?**
@@ -698,10 +698,9 @@ require('lazy').setup({
698698
699699 -- LSP servers and clients are able to communicate to each other what features they support.
700700 -- By default, Neovim doesn't support everything that is in the LSP specification.
701- -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
702- -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
703- local capabilities = vim .lsp .protocol .make_client_capabilities ()
704- capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
701+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
702+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
703+ local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
705704
706705 -- Enable the following language servers
707706 -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -820,12 +819,14 @@ require('lazy').setup({
820819 },
821820
822821 { -- Autocompletion
823- ' hrsh7th/nvim-cmp' ,
824- event = ' InsertEnter' ,
822+ ' saghen/blink.cmp' ,
823+ event = ' VimEnter' ,
824+ version = ' 1.*' ,
825825 dependencies = {
826- -- Snippet Engine & its associated nvim-cmp source
826+ -- Snippet Engine
827827 {
828828 ' L3MON4D3/LuaSnip' ,
829+ version = ' 2.*' ,
829830 build = (function ()
830831 -- Build Step is needed for regex support in snippets.
831832 -- This step is not supported in many windows environments.
@@ -846,95 +847,74 @@ require('lazy').setup({
846847 -- end,
847848 -- },
848849 },
850+ opts = {},
849851 },
850- ' saadparwaiz1/cmp_luasnip' ,
851-
852- -- Adds other completion capabilities.
853- -- nvim-cmp does not ship with all sources by default. They are split
854- -- into multiple repos for maintenance purposes.
855- ' hrsh7th/cmp-nvim-lsp' ,
856- ' hrsh7th/cmp-path' ,
857- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
852+ ' folke/lazydev.nvim' ,
858853 },
859- config = function ()
860- -- See `:help cmp`
861- local cmp = require ' cmp'
862- local luasnip = require ' luasnip'
863- luasnip .config .setup {}
864-
865- cmp .setup {
866- snippet = {
867- expand = function (args )
868- luasnip .lsp_expand (args .body )
869- end ,
870- },
871- completion = { completeopt = ' menu,menuone,noinsert' },
872-
873- -- For an understanding of why these mappings were
874- -- chosen, you will need to read `:help ins-completion`
854+ --- @module ' blink.cmp'
855+ --- @type blink.cmp.Config
856+ opts = {
857+ keymap = {
858+ -- 'default' (recommended) for mappings similar to built-in completions
859+ -- <c-y> to 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+ -- 'super-tab' for tab to accept
863+ -- 'enter' for enter to accept
864+ -- 'none' for no mappings
865+ --
866+ -- For an understanding of why the 'default' preset is recommended,
867+ -- you will need to read `:help ins-completion`
875868 --
876869 -- No, but seriously. Please read `:help ins-completion`, it is really good!
877- mapping = cmp .mapping .preset .insert {
878- -- Select the [n]ext item
879- [' <C-n>' ] = cmp .mapping .select_next_item (),
880- -- Select the [p]revious item
881- [' <C-p>' ] = cmp .mapping .select_prev_item (),
882-
883- -- Scroll the documentation window [b]ack / [f]orward
884- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
885- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
886-
887- -- Accept ([y]es) the completion.
888- -- This will auto-import if your LSP supports it.
889- -- This will expand snippets if the LSP sent a snippet.
890- [' <C-y>' ] = cmp .mapping .confirm { select = true },
891-
892- -- If you prefer more traditional completion keymaps,
893- -- you can uncomment the following lines
894- -- ['<CR>'] = cmp.mapping.confirm { select = true },
895- -- ['<Tab>'] = cmp.mapping.select_next_item(),
896- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
897-
898- -- Manually trigger a completion from nvim-cmp.
899- -- Generally you don't need this, because nvim-cmp will display
900- -- completions whenever it has completion options available.
901- [' <C-Space>' ] = cmp .mapping .complete {},
902-
903- -- Think of <c-l> as moving to the right of your snippet expansion.
904- -- So if you have a snippet that's like:
905- -- function $name($args)
906- -- $body
907- -- end
908- --
909- -- <c-l> will move you to the right of each of the expansion locations.
910- -- <c-h> is similar, except moving you backwards.
911- [' <C-l>' ] = cmp .mapping (function ()
912- if luasnip .expand_or_locally_jumpable () then
913- luasnip .expand_or_jump ()
914- end
915- end , { ' i' , ' s' }),
916- [' <C-h>' ] = cmp .mapping (function ()
917- if luasnip .locally_jumpable (- 1 ) then
918- luasnip .jump (- 1 )
919- end
920- end , { ' i' , ' s' }),
870+ --
871+ -- All presets have the following mappings:
872+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
873+ -- <c-space>: Open menu or open docs if already open
874+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
875+ -- <c-e>: Hide menu
876+ -- <c-k>: Toggle signature help
877+ --
878+ -- See :h blink-cmp-config-keymap for defining your own keymap
879+ preset = ' default' ,
921880
922- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
923- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
924- },
925- sources = {
926- {
927- name = ' lazydev' ,
928- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
929- group_index = 0 ,
930- },
931- { name = ' nvim_lsp' },
932- { name = ' luasnip' },
933- { name = ' path' },
934- { name = ' nvim_lsp_signature_help' },
881+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
882+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
883+ },
884+
885+ appearance = {
886+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
887+ -- Adjusts spacing to ensure icons are aligned
888+ nerd_font_variant = ' mono' ,
889+ },
890+
891+ completion = {
892+ -- By default, you may press `<c-space>` to show the documentation.
893+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
894+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
895+ },
896+
897+ sources = {
898+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
899+ providers = {
900+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
935901 },
936- }
937- end ,
902+ },
903+
904+ snippets = { preset = ' luasnip' },
905+
906+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
907+ -- which automatically downloads a prebuilt binary when enabled.
908+ --
909+ -- By default, we use the Lua implementation instead, but you may enable
910+ -- the rust implementation via `'prefer_rust_with_warning'`
911+ --
912+ -- See :h blink-cmp-config-fuzzy for more information
913+ fuzzy = { implementation = ' lua' },
914+
915+ -- Shows a signature help window while you type arguments for a function
916+ signature = { enabled = true },
917+ },
938918 },
939919
940920 {
0 commit comments