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