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