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