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