huge updates
This commit is contained in:
1 parent
ca26b00c27
commit
18bd0cb00b
49 files changed
+4210
-2140
No files matched your search
@@ -0,0 +1,90 @@
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
require('luasnip/loaders/from_vscode').lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
keyword_length = 1,
|
||||
completeopt = 'menu,menuone',
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'kind', 'abbr', 'menu' },
|
||||
format = function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, '%s', { trimempty = true })
|
||||
kind.kind = ' ' .. (strings[1] or '') .. ' '
|
||||
kind.menu = ' (' .. (strings[2] or '') .. ')'
|
||||
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-1), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(1), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-y>'] = cmp.config.disable,
|
||||
['<C-c>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
}),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'cmdline' },
|
||||
},
|
||||
}),
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- snippets
|
||||
{ name = 'buffer' }, -- text within current buffer
|
||||
{ name = 'path' }, -- file system paths
|
||||
{ name = 'codeium' }, -- AI for autocompletion
|
||||
-- { name = "nvim_lsp_signature_help" },
|
||||
-- { name = "calc" }, --for maths calculations
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user