feat(cmp): add configs for cmp.setup.cmdline (#3180)

This commit is contained in:
Ali Almohaya 2022-10-09 02:10:53 +03:00 committed by GitHub
parent e6f50af1de
commit 5aec1756ce
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -334,6 +334,23 @@ M.config = function()
fallback() -- if not exited early, always fallback
end),
},
cmdline = {
enable = true,
options = {
{
type = ":",
sources = {
{ name = "path" },
},
},
{
type = { "/", "?" },
sources = {
{ name = "buffer" },
},
},
},
},
}
end
@ -341,18 +358,14 @@ function M.setup()
local cmp = require "cmp"
cmp.setup(lvim.builtin.cmp)
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "path" },
},
})
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
if lvim.builtin.cmp.cmdline.enable then
for _, option in ipairs(lvim.builtin.cmp.cmdline.options) do
cmp.setup.cmdline(option.type, {
mapping = cmp.mapping.preset.cmdline(),
sources = option.sources,
})
end
end
end
return M