@@ -524,8 +524,8 @@ require('lazy').setup({
524524 -- Useful status updates for LSP.
525525 { ' j-hui/fidget.nvim' , opts = {} },
526526
527- -- Allows extra capabilities provided by nvim- cmp
528- ' hrsh7th/ cmp-nvim-lsp ' ,
527+ -- Allows extra capabilities provided by blink. cmp
528+ ' saghen/blink. cmp' ,
529529 },
530530 config = function ()
531531 -- Brief aside: **What is LSP?**
@@ -697,10 +697,9 @@ require('lazy').setup({
697697
698698 -- LSP servers and clients are able to communicate to each other what features they support.
699699 -- By default, Neovim doesn't support everything that is in the LSP specification.
700- -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
701- -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
702- local capabilities = vim .lsp .protocol .make_client_capabilities ()
703- capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
700+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
701+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
702+ local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
704703
705704 -- Enable the following language servers
706705 -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -861,12 +860,14 @@ require('lazy').setup({
861860 },
862861
863862 { -- Autocompletion
864- ' hrsh7th/nvim-cmp' ,
865- event = ' InsertEnter' ,
863+ ' saghen/blink.cmp' ,
864+ event = ' VimEnter' ,
865+ version = ' 1.*' ,
866866 dependencies = {
867- -- Snippet Engine & its associated nvim-cmp source
867+ -- Snippet Engine
868868 {
869869 ' L3MON4D3/LuaSnip' ,
870+ version = ' 2.*' ,
870871 build = (function ()
871872 -- Build Step is needed for regex support in snippets.
872873 -- This step is not supported in many windows environments.
@@ -887,95 +888,74 @@ require('lazy').setup({
887888 end ,
888889 },
889890 },
891+ opts = {},
890892 },
891- ' saadparwaiz1/cmp_luasnip' ,
892-
893- -- Adds other completion capabilities.
894- -- nvim-cmp does not ship with all sources by default. They are split
895- -- into multiple repos for maintenance purposes.
896- ' hrsh7th/cmp-nvim-lsp' ,
897- ' hrsh7th/cmp-path' ,
898- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
893+ ' folke/lazydev.nvim' ,
899894 },
900- config = function ()
901- -- See `:help cmp`
902- local cmp = require ' cmp'
903- local luasnip = require ' luasnip'
904- luasnip .config .setup {}
905-
906- cmp .setup {
907- snippet = {
908- expand = function (args )
909- luasnip .lsp_expand (args .body )
910- end ,
911- },
912- completion = { completeopt = ' menu,menuone,noinsert' },
913-
914- -- For an understanding of why these mappings were
915- -- chosen, you will need to read `:help ins-completion`
895+ --- @module ' blink.cmp'
896+ --- @type blink.cmp.Config
897+ opts = {
898+ keymap = {
899+ -- 'default' (recommended) for mappings similar to built-in completions
900+ -- <c-y> to accept ([y]es) the completion.
901+ -- This will auto-import if your LSP supports it.
902+ -- This will expand snippets if the LSP sent a snippet.
903+ -- 'super-tab' for tab to accept
904+ -- 'enter' for enter to accept
905+ -- 'none' for no mappings
906+ --
907+ -- For an understanding of why the 'default' preset is recommended,
908+ -- you will need to read `:help ins-completion`
916909 --
917910 -- No, but seriously. Please read `:help ins-completion`, it is really good!
918- mapping = cmp .mapping .preset .insert {
919- -- Select the [n]ext item
920- [' <C-n>' ] = cmp .mapping .select_next_item (),
921- -- Select the [p]revious item
922- [' <C-p>' ] = cmp .mapping .select_prev_item (),
923-
924- -- Scroll the documentation window [b]ack / [f]orward
925- [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
926- [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
927-
928- -- Accept ([y]es) the completion.
929- -- This will auto-import if your LSP supports it.
930- -- This will expand snippets if the LSP sent a snippet.
931- [' <C-y>' ] = cmp .mapping .confirm { select = true },
932-
933- -- If you prefer more traditional completion keymaps,
934- -- you can uncomment the following lines
935- -- ['<CR>'] = cmp.mapping.confirm { select = true },
936- -- ['<Tab>'] = cmp.mapping.select_next_item(),
937- -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
938-
939- -- Manually trigger a completion from nvim-cmp.
940- -- Generally you don't need this, because nvim-cmp will display
941- -- completions whenever it has completion options available.
942- [' <C-Space>' ] = cmp .mapping .complete {},
943-
944- -- Think of <c-l> as moving to the right of your snippet expansion.
945- -- So if you have a snippet that's like:
946- -- function $name($args)
947- -- $body
948- -- end
949- --
950- -- <c-l> will move you to the right of each of the expansion locations.
951- -- <c-h> is similar, except moving you backwards.
952- [' <C-l>' ] = cmp .mapping (function ()
953- if luasnip .expand_or_locally_jumpable () then
954- luasnip .expand_or_jump ()
955- end
956- end , { ' i' , ' s' }),
957- [' <C-h>' ] = cmp .mapping (function ()
958- if luasnip .locally_jumpable (- 1 ) then
959- luasnip .jump (- 1 )
960- end
961- end , { ' i' , ' s' }),
911+ --
912+ -- All presets have the following mappings:
913+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
914+ -- <c-space>: Open menu or open docs if already open
915+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
916+ -- <c-e>: Hide menu
917+ -- <c-k>: Toggle signature help
918+ --
919+ -- See :h blink-cmp-config-keymap for defining your own keymap
920+ preset = ' default' ,
962921
963- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
964- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
965- },
966- sources = {
967- {
968- name = ' lazydev' ,
969- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
970- group_index = 0 ,
971- },
972- { name = ' nvim_lsp' },
973- { name = ' luasnip' },
974- { name = ' path' },
975- { name = ' nvim_lsp_signature_help' },
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+
926+ appearance = {
927+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
928+ -- Adjusts spacing to ensure icons are aligned
929+ nerd_font_variant = ' mono' ,
930+ },
931+
932+ completion = {
933+ -- By default, you may press `<c-space>` to show the documentation.
934+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
935+ documentation = { auto_show = false , auto_show_delay_ms = 500 },
936+ },
937+
938+ sources = {
939+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
940+ providers = {
941+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
976942 },
977- }
978- end ,
943+ },
944+
945+ snippets = { preset = ' luasnip' },
946+
947+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
948+ -- which automatically downloads a prebuilt binary when enabled.
949+ --
950+ -- By default, we use the Lua implementation instead, but you may enable
951+ -- the rust implementation via `'prefer_rust_with_warning'`
952+ --
953+ -- See :h blink-cmp-config-fuzzy for more information
954+ fuzzy = { implementation = ' lua' },
955+
956+ -- Shows a signature help window while you type arguments for a function
957+ signature = { enabled = true },
958+ },
979959 },
980960
981961 { -- You can easily change to a different colorscheme.
0 commit comments