add more completion sources
This commit is contained in:
@@ -6,17 +6,20 @@ return {
|
|||||||
'hrsh7th/cmp-path',
|
'hrsh7th/cmp-path',
|
||||||
'hrsh7th/cmp-cmdline',
|
'hrsh7th/cmp-cmdline',
|
||||||
'hrsh7th/cmp-buffer',
|
'hrsh7th/cmp-buffer',
|
||||||
|
'hrsh7th/cmp-calc',
|
||||||
|
'hrsh7th/cmp-nvim-lua',
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
'hrsh7th/cmp-nvim-lsp-document-symbol',
|
'hrsh7th/cmp-nvim-lsp-document-symbol',
|
||||||
'hrsh7th/cmp-nvim-lsp-signature-help',
|
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||||
'saadparwaiz1/cmp_luasnip',
|
'davidsierradz/cmp-conventionalcommits',
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
'onsails/lspkind.nvim',
|
'onsails/lspkind.nvim',
|
||||||
{
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
version = 'v2.*',
|
version = 'v2.*',
|
||||||
build = 'make install_jsregexp',
|
build = 'make install_jsregexp',
|
||||||
},
|
},
|
||||||
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
@@ -63,8 +66,8 @@ return {
|
|||||||
-- ┌
|
-- ┌
|
||||||
-- │ if completion menu is visible, move prev/next with
|
-- │ if completion menu is visible, move prev/next with
|
||||||
-- │ tab/s-tab
|
-- │ tab/s-tab
|
||||||
-- │ if we're not attached to anything, then insert a tab
|
-- │ if not attached to anything, then insert a tab
|
||||||
-- │ if we're inside a word, trigger the completion menu
|
-- │ if inside a word, trigger the completion menu
|
||||||
-- └
|
-- └
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
local col = vim.fn.col('.') - 1
|
local col = vim.fn.col('.') - 1
|
||||||
@@ -103,10 +106,15 @@ return {
|
|||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp', priority = 1 },
|
{ name = 'nvim_lsp', priority = 1 },
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
{ name = 'luasnip', priority = 2 },
|
{ name = 'luasnip', priority = 2 },
|
||||||
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
|
{ name = 'conventionalcommits' },
|
||||||
{ name = 'buffer', keyword_length = 3 },
|
{ name = 'buffer', keyword_length = 3 },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
|
{ name = 'calc' },
|
||||||
}),
|
}),
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
formatting = {
|
formatting = {
|
||||||
-- fields = { 'abbr', 'kind', 'menu' },
|
-- fields = { 'abbr', 'kind', 'menu' },
|
||||||
expandable_indicator = true,
|
expandable_indicator = true,
|
||||||
@@ -137,7 +145,8 @@ return {
|
|||||||
})(entry, vim_item)
|
})(entry, vim_item)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- VSCode-like, kind specific highlights
|
|
||||||
|
-- ───────────────[ VSCode-like, kind specific highlights ]───────────────
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemAbbrDeprecated', { bg = 'NONE', strikethrough = true, fg = '#4c566a' }),
|
vim.api.nvim_set_hl(0, 'CmpItemAbbrDeprecated', { bg = 'NONE', strikethrough = true, fg = '#4c566a' }),
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { bg = 'NONE', fg = '#81a1c1' }),
|
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { bg = 'NONE', fg = '#81a1c1' }),
|
||||||
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { link = 'CmpIntemAbbrMatch' }),
|
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { link = 'CmpIntemAbbrMatch' }),
|
||||||
@@ -160,6 +169,7 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
|
{ name = 'nvim_lsp_document_symbol' },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -179,6 +189,7 @@ return {
|
|||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
{ name = 'cmdline' },
|
{ name = 'cmdline' },
|
||||||
}),
|
}),
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
matching = {
|
matching = {
|
||||||
disallow_fullfuzzy_matching = false,
|
disallow_fullfuzzy_matching = false,
|
||||||
disallow_fuzzy_matching = false,
|
disallow_fuzzy_matching = false,
|
||||||
|
|||||||
Reference in New Issue
Block a user