nvim: changed completion source order

This commit is contained in:
PowerUser64 2021-11-25 04:30:58 -08:00
parent e048d023a5
commit 8e69c8385a

View file

@ -121,6 +121,10 @@ M.cmp = function()
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,
}, },
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
-- select = true,
},
['<Tab>'] = function(fallback) ['<Tab>'] = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
@ -138,12 +142,11 @@ M.cmp = function()
}, },
sources = { sources = {
{ name = 'path' }, { name = 'path' },
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'calc' },
{ name = 'nvim_lua' }, { name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'calc' },
{ name = 'spell' }, { name = 'spell' },
{ name = 'treesitter' }, { name = 'buffer' },
{ name = 'emoji' }, { name = 'emoji' },
}, },
formatting = { formatting = {
@ -153,12 +156,11 @@ M.cmp = function()
-- set a name for each source -- set a name for each source
vim_item.menu = ({ vim_item.menu = ({
path = "[Path]", path = "[Path]",
nvim_lsp = "[LSP]",
buffer = "[Buffer]",
calc = "[Calc]",
nvim_lua = "[Lua]", nvim_lua = "[Lua]",
nvim_lsp = "[LSP]",
calc = "[Calc]",
spell = "[Spell]", spell = "[Spell]",
treesitter = "[TS]", buffer = "[Buffer]",
})[entry.source.name] })[entry.source.name]
return vim_item return vim_item
end, end,
@ -234,7 +236,7 @@ M.lspconfig = function()
end end
-- From kickstart.nvim: -- From kickstart.nvim:
if (vim.fn.executable(sumneko_binary) == true) then if (vim.fn.executable(sumneko_binary) == 1) then
-- Make runtime files discoverable to the server -- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';') local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua') table.insert(runtime_path, 'lua/?.lua')