@@ -650,12 +650,8 @@ require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a gith
650
650
-- Useful status updates for LSP.
651
651
{ ' j-hui/fidget.nvim' , opts = {} },
652
652
653
- -- Allows extra capabilities provided by nvim-cmp
654
- ' hrsh7th/cmp-nvim-lsp' ,
655
- -- {
656
- -- 'folke/neodev.nvim',
657
- -- opts = {},
658
- -- },
653
+ -- Allows extra capabilities provided by blink.cmp
654
+ ' saghen/blink.cmp' ,
659
655
},
660
656
config = function ()
661
657
-- Brief aside: **What is LSP?**
@@ -822,10 +818,9 @@ require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a gith
822
818
823
819
-- LSP servers and clients are able to communicate to each other what features they support.
824
820
-- By default, Neovim doesn't support everything that is in the LSP specification.
825
- -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
826
- -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
827
- local capabilities = vim .lsp .protocol .make_client_capabilities ()
828
- capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
821
+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
822
+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
823
+ local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
829
824
830
825
-- Enable the following language servers
831
826
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -1009,11 +1004,14 @@ require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a gith
1009
1004
},
1010
1005
},
1011
1006
{ -- Autocompletion
1012
- ' hrsh7th/nvim-cmp' ,
1013
- event = ' InsertEnter' ,
1014
- dependencies = { -- Snippet Engine & its associated nvim-cmp source
1007
+ ' saghen/blink.cmp' ,
1008
+ event = ' VimEnter' ,
1009
+ version = ' 1.*' ,
1010
+ dependencies = {
1011
+ -- Snippet Engine
1015
1012
{
1016
1013
' L3MON4D3/LuaSnip' ,
1014
+ version = ' 2.*' ,
1017
1015
build = (function ()
1018
1016
-- Build Step is needed for regex support in snippets.
1019
1017
-- This step is not supported in many windows environments.
@@ -1034,39 +1032,36 @@ require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a gith
1034
1032
end ,
1035
1033
},
1036
1034
},
1035
+ opts = {},
1037
1036
},
1038
- ' saadparwaiz1/cmp_luasnip' , -- Adds other completion capabilities.
1039
- -- nvim-cmp does not ship with all sources by default. They are split
1040
- -- into multiple repos for maintenance purposes.
1041
- ' hrsh7th/cmp-nvim-lsp' ,
1042
- ' hrsh7th/cmp-path' ,
1043
- ' hrsh7th/cmp-nvim-lsp-signature-help' ,
1037
+ ' folke/lazydev.nvim' ,
1044
1038
},
1045
- config = function ()
1046
- -- See `:help cmp`
1047
- local cmp = require ' cmp'
1048
- local luasnip = require ' luasnip'
1049
- luasnip .config .setup {}
1050
-
1051
- cmp .setup {
1052
- snippet = {
1053
- expand = function (args )
1054
- luasnip .lsp_expand (args .body )
1055
- end ,
1056
- },
1057
- completion = {
1058
- completeopt = ' menu,menuone,noinsert' ,
1059
- },
1060
-
1061
- -- For an understanding of why these mappings were
1062
- -- chosen, you will need to read `:help ins-completion`
1039
+ --- @module ' blink.cmp'
1040
+ --- @type blink.cmp.Config
1041
+ opts = {
1042
+ keymap = {
1043
+ -- 'default' (recommended) for mappings similar to built-in completions
1044
+ -- <c-y> to accept ([y]es) the completion.
1045
+ -- This will auto-import if your LSP supports it.
1046
+ -- This will expand snippets if the LSP sent a snippet.
1047
+ -- 'super-tab' for tab to accept
1048
+ -- 'enter' for enter to accept
1049
+ -- 'none' for no mappings
1050
+ --
1051
+ -- For an understanding of why the 'default' preset is recommended,
1052
+ -- you will need to read `:help ins-completion`
1063
1053
--
1064
1054
-- No, but seriously. Please read `:help ins-completion`, it is really good!
1065
- mapping = cmp .mapping .preset .insert {
1066
- -- Select the [n]ext item
1067
- [' <C-n>' ] = cmp .mapping .select_next_item (),
1068
- -- Select the [p]revious item
1069
- [' <C-p>' ] = cmp .mapping .select_prev_item (),
1055
+ --
1056
+ -- All presets have the following mappings:
1057
+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
1058
+ -- <c-space>: Open menu or open docs if already open
1059
+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
1060
+ -- <c-e>: Hide menu
1061
+ -- <c-k>: Toggle signature help
1062
+ --
1063
+ -- See :h blink-cmp-config-keymap for defining your own keymap
1064
+ preset = ' default' ,
1070
1065
1071
1066
-- Scroll the documentation window [b]ack / [f]orward
1072
1067
[' <C-d>' ] = cmp .mapping .scroll_docs (- 4 ),
@@ -1083,32 +1078,10 @@ require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a gith
1083
1078
select = true ,
1084
1079
},
1085
1080
1086
- -- Manually trigger a completion from nvim-cmp.
1087
- -- Generally you don't need this, because nvim-cmp will display
1088
- -- completions whenever it has completion options available.
1089
- [' <C-Space>' ] = cmp .mapping .complete {},
1090
-
1091
- -- Think of <c-l> as moving to the right of your snippet expansion.
1092
- -- So if you have a snippet that's like:
1093
- -- function $name($args)
1094
- -- $body
1095
- -- end
1096
- --
1097
- -- <c-l> will move you to the right of each of the expansion locations.
1098
- -- <c-h> is similar, except moving you backwards.
1099
- [' <C-l>' ] = cmp .mapping (function ()
1100
- if luasnip .expand_or_locally_jumpable () then
1101
- luasnip .expand_or_jump ()
1102
- end
1103
- end , { ' i' , ' s' }),
1104
- [' <C-h>' ] = cmp .mapping (function ()
1105
- if luasnip .locally_jumpable (- 1 ) then
1106
- luasnip .jump (- 1 )
1107
- end
1108
- end , { ' i' , ' s' }),
1109
-
1110
- -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
1111
- -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
1081
+ sources = {
1082
+ default = { ' lsp' , ' path' , ' snippets' , ' lazydev' },
1083
+ providers = {
1084
+ lazydev = { module = ' lazydev.integrations.blink' , score_offset = 100 },
1112
1085
},
1113
1086
sources = {
1114
1087
{
0 commit comments