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