refactor: clean up code

main
mandlm 2022-06-29 08:41:32 +02:00
parent 0a089bdd55
commit 3e4977e02d
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7
1 changed files with 17 additions and 11 deletions

View File

@ -5,7 +5,7 @@ local has_words_before = function()
col, col):match("%s") == nil
end
local cmp = require('cmp')
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
@ -14,7 +14,7 @@ cmp.setup({
luasnip.lsp_expand(args.body)
end
},
sources = require("cmp").config.sources({
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
@ -23,11 +23,11 @@ cmp.setup({
{ name = "calc" },
}),
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
@ -53,10 +53,16 @@ cmp.setup({
})
-- `/` cmdline setup.
cmp.setup.cmdline('/', { sources = { { name = 'buffer' } } })
cmp.setup.cmdline("/", {
sources = cmp.config.sources(
{ { name = "buffer" } }
)
})
-- `:` cmdline setup.
cmp.setup.cmdline(':', {
sources = cmp.config
.sources({ { name = 'path' } }, { { name = 'cmdline' } })
cmp.setup.cmdline(":", {
sources = cmp.config.sources(
{ { name = "path" } },
{ { name = "cmdline" } }
)
})