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