Browse Source

Bugfix: autocomplete not working properly

pull/14/head
Ptrzl 3 years ago
parent
commit
fdf0f86ce0
  1. 72
      lua/configs/autocomplete.lua

72
lua/configs/autocomplete.lua

@ -14,50 +14,72 @@ function M.config()
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
mapping = { -- TODO: do these mappings
mapping = {
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
--[''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
--[''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
--[''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
--[''] = cmp.mapping({
-- i = cmp.mapping.abort(),
-- c = cmp.mapping.close(),
--}),
},
sources = cmp.config.sources({
{ name = 'luasnip' },
-- { name = 'nvim_lsp' },
-- { name = 'ultisnips' },
-- { name = 'snippy' },
}, {{ name = 'buffer' }})
{ name = 'nvim_lsp' },
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
})
-- completion for status line commands (if you enabled `native_menu`, this won't work anymore).
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- nvim-lspconfig config
local servers = { 'clangd', 'ccls' }
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'ccls' }
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
flags = {
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
}
}
end
-- C-CPP-Modern config
vim.g.cpp_function_highlight = 1
vim.g.cpp_attributes_highlight = 1
vim.g.cpp_member_highlight = 1
vim.g.cpp_simple_highlight = 1
end
return M

Loading…
Cancel
Save