@@ -486,8 +486,8 @@ require('lazy').setup({
486
486
-- Useful status updates for LSP.
487
487
{ ' j-hui/fidget.nvim' , opts = {} },
488
488
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' ,
491
491
},
492
492
config = function ()
493
493
-- Brief aside: **What is LSP?**
@@ -654,10 +654,9 @@ require('lazy').setup({
654
654
655
655
-- LSP servers and clients are able to communicate to each other what features they support.
656
656
-- 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 ()
661
660
662
661
-- Enable the following language servers
663
662
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -776,12 +775,14 @@ require('lazy').setup({
776
775
},
777
776
778
777
{ -- Autocompletion
779
- ' hrsh7th/nvim-cmp' ,
780
- event = ' InsertEnter' ,
778
+ ' saghen/blink.cmp' ,
779
+ event = ' VimEnter' ,
780
+ version = ' 1.*' ,
781
781
dependencies = {
782
- -- Snippet Engine & its associated nvim-cmp source
782
+ -- Snippet Engine
783
783
{
784
784
' L3MON4D3/LuaSnip' ,
785
+ version = ' 2.*' ,
785
786
build = (function ()
786
787
-- Build Step is needed for regex support in snippets.
787
788
-- This step is not supported in many windows environments.
@@ -802,95 +803,66 @@ require('lazy').setup({
802
803
-- end,
803
804
-- },
804
805
},
806
+ opts = {},
805
807
},
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' ,
814
809
},
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
+ opts = {
811
+ keymap = {
812
+ -- 'default' (recommended) for mappings similar to built-in completions
813
+ -- <c-y> to accept ([y]es) the completion.
814
+ -- This will auto-import if your LSP supports it.
815
+ -- This will expand snippets if the LSP sent a snippet.
816
+ -- 'super-tab' for tab to accept
817
+ -- 'enter' for enter to accept
818
+ -- 'none' for no mappings
819
+ --
820
+ -- For an understanding of why the 'default' preset is recommended,
821
+ -- you will need to read `:help ins-completion`
831
822
--
832
823
-- 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' }),
824
+ --
825
+ -- All presets have the following mappings:
826
+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
827
+ -- <c-space>: Open menu or open docs if already open
828
+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
829
+ -- <c-e>: Hide menu
830
+ -- <c-k>: Toggle signature help
831
+ --
832
+ -- See :h blink-cmp-config-keymap for defining your own keymap
833
+ preset = ' default' ,
877
834
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' },
835
+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
836
+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
837
+ },
838
+
839
+ appearance = {
840
+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
841
+ -- Adjusts spacing to ensure icons are aligned
842
+ nerd_font_variant = ' mono' ,
843
+ },
844
+
845
+ sources = {
846
+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
847
+ providers = {
848
+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
891
849
},
892
- }
893
- end ,
850
+ },
851
+
852
+ snippets = { preset = ' luasnip' },
853
+
854
+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
855
+ -- which will automatically downloaded a prebuilt binary when enabled.
856
+ --
857
+ -- By default, we use the Lua implementation instead, but you may enable
858
+ -- the rust implementation via `'prefer_rust_with_warning'`
859
+ --
860
+ -- See :h blink-cmp-config-fuzzy for more information
861
+ fuzzy = { implementation = ' lua' },
862
+
863
+ -- Shows a signature help window while you type arguments for a function
864
+ signature = { enabled = true },
865
+ },
894
866
},
895
867
896
868
{ -- You can easily change to a different colorscheme.
0 commit comments