replace cmp with blink-cmp
This commit is contained in:
@@ -4,13 +4,7 @@ return {
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'hrsh7th/nvim-cmp',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'SergioRibera/cmp-dotenv',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'saghen/blink.cmp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'j-hui/fidget.nvim',
|
||||
'rafamadriz/friendly-snippets',
|
||||
@@ -31,7 +25,6 @@ return {
|
||||
config = function()
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
-- load snippets from friendly-snippets
|
||||
@@ -56,69 +49,13 @@ return {
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
require('lspconfig')[server_name].setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
end,
|
||||
}
|
||||
})
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip', keyword_length = 2 },
|
||||
{ name = 'buffer', keyword_length = 3 },
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- `Enter` key to confirm completion
|
||||
['<CR>'] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
}),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
-- Ctrl+Space to trigger completion menu
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
|
||||
-- Scroll up and down in the completion documentation
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local pythonLineLength = 95
|
||||
lspconfig.pylsp.setup {
|
||||
settings = {
|
||||
@@ -146,9 +83,7 @@ return {
|
||||
}
|
||||
}
|
||||
|
||||
lspconfig.yamlls.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
lspconfig.yamlls.setup { }
|
||||
|
||||
lspconfig.terraformls.setup {
|
||||
filetypes = { 'terraform', 'terraform-vars', 'tf' }
|
||||
|
||||
Reference in New Issue
Block a user