style:♻️ refactor autocomplete configuration
This commit is contained in:
@@ -10,9 +10,7 @@ return {
|
|||||||
'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',
|
||||||
'davidsierradz/cmp-conventionalcommits',
|
|
||||||
'chrisgrieser/cmp-nerdfont', -- triggered by ':' (insert mode)
|
'chrisgrieser/cmp-nerdfont', -- triggered by ':' (insert mode)
|
||||||
'Dynge/gitmoji.nvim',
|
|
||||||
'onsails/lspkind.nvim',
|
'onsails/lspkind.nvim',
|
||||||
{
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
@@ -111,12 +109,10 @@ return {
|
|||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp', priority = 1 },
|
{ name = 'nvim_lsp', priority = 1 },
|
||||||
{ name = 'nvim_lua' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'luasnip', priority = 2 },
|
|
||||||
{ name = 'nvim_lsp_signature_help' },
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
{ name = 'nerdfont' },
|
{ name = 'nerdfont' },
|
||||||
{ name = 'gitmoji' },
|
|
||||||
{ name = 'conventionalcommits' },
|
|
||||||
{ name = 'buffer', keyword_length = 3 },
|
{ name = 'buffer', keyword_length = 3 },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
{ name = 'calc' },
|
{ name = 'calc' },
|
||||||
@@ -127,7 +123,7 @@ return {
|
|||||||
expandable_indicator = true,
|
expandable_indicator = true,
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
if vim.tbl_contains({ 'path' }, entry.source.name) then
|
if vim.tbl_contains({ 'path' }, entry.source.name) then
|
||||||
local icon, hl_group = require('nvim-web-devicons').get_icon(entry.completion_item().label)
|
local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label)
|
||||||
if icon then
|
if icon then
|
||||||
vim_item.kind = icon
|
vim_item.kind = icon
|
||||||
vim_item.kind_hl_group = hl_group
|
vim_item.kind_hl_group = hl_group
|
||||||
@@ -135,7 +131,7 @@ return {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return lspkind.cmp_format({
|
return lspkind.cmp_format({
|
||||||
with_text = true,
|
with_text = false,
|
||||||
mode = 'symbol_text',
|
mode = 'symbol_text',
|
||||||
maxwidth = 50,
|
maxwidth = 50,
|
||||||
ellipsis_char = '...',
|
ellipsis_char = '...',
|
||||||
@@ -144,10 +140,11 @@ return {
|
|||||||
-- add name of source to the menu
|
-- add name of source to the menu
|
||||||
nvim_lsp = '[LSP]',
|
nvim_lsp = '[LSP]',
|
||||||
nvim_lua = '[Lua]',
|
nvim_lua = '[Lua]',
|
||||||
luasnip = '[LuaSnip]',
|
luasnip = '[Snip]',
|
||||||
buffer = '[Buffer]',
|
buffer = '[Buf]',
|
||||||
path = '[Path]',
|
path = '[Path]',
|
||||||
latex_symbols = '[Latex]',
|
latex_symbols = '[Latex]',
|
||||||
|
spell = '[Spell]',
|
||||||
},
|
},
|
||||||
})(entry, vim_item)
|
})(entry, vim_item)
|
||||||
end,
|
end,
|
||||||
@@ -172,7 +169,7 @@ return {
|
|||||||
view = {
|
view = {
|
||||||
entries = {
|
entries = {
|
||||||
name = 'wildmenu',
|
name = 'wildmenu',
|
||||||
separator = '|',
|
separator = '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
@@ -181,6 +178,8 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- FIX: on my Arch laptop, 't' as first character on cmdline escapes
|
||||||
|
-- the cmdline and destructively prints xx:xx to the document
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(':', {
|
||||||
enabled = function()
|
enabled = function()
|
||||||
local disabled = {
|
local disabled = {
|
||||||
@@ -192,10 +191,10 @@ return {
|
|||||||
return not disabled[cmd] or cmp.close()
|
return not disabled[cmd] or cmp.close()
|
||||||
end,
|
end,
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = cmp.config.sources({
|
sources = {
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'cmdline' },
|
{ name = 'cmdline' },
|
||||||
}),
|
{ name = 'path' },
|
||||||
|
},
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
matching = {
|
matching = {
|
||||||
disallow_fullfuzzy_matching = false,
|
disallow_fullfuzzy_matching = false,
|
||||||
|
|||||||
Reference in New Issue
Block a user