add load on event, change mappings, add dap
This commit is contained in:
parent
7da11777fe
commit
e1f253fbd9
@ -11,6 +11,7 @@ local M = {
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-calc',
|
||||
},
|
||||
event = { 'InsertEnter', 'CmdlineEnter' },
|
||||
}
|
||||
|
||||
function M.config()
|
||||
@ -27,6 +28,9 @@ function M.config()
|
||||
end
|
||||
|
||||
cmp.setup {
|
||||
enabled = function()
|
||||
return vim.api.nvim_buf_get_option(0, 'buftype') ~= 'prompt' or require('cmp_dap').is_dap_buffer()
|
||||
end,
|
||||
view = {
|
||||
entries = {
|
||||
name = 'custom', -- can be "custom", "wildmenu" or "native"
|
||||
@ -120,10 +124,10 @@ function M.config()
|
||||
mapping = {
|
||||
['<TAB>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
|
||||
cmp.select_next_item()
|
||||
-- cmp.complete()
|
||||
else
|
||||
cmp.complete()
|
||||
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
|
||||
end
|
||||
end, { 'i', 's', 'c' }),
|
||||
['<S-TAB>'] = cmp.mapping(function(fallback)
|
||||
@ -133,7 +137,16 @@ function M.config()
|
||||
cmp.complete()
|
||||
end
|
||||
end, { 'i', 's', 'c' }),
|
||||
['<CR>'] = cmp.mapping { i = cmp.mapping.confirm { select = true } },
|
||||
['<CR>'] = cmp.mapping {
|
||||
i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||
c = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
{ name = 'cmdline' },
|
||||
@ -154,6 +167,12 @@ function M.config()
|
||||
entries = { name = 'wildmenu', separator = ' · ' },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.filetype({ 'dap-repl', 'dapui_watches', 'dapui_hover' }, {
|
||||
sources = {
|
||||
{ name = 'dap' },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
Reference in New Issue
Block a user