.config/nvim/lua/plugins/lsp.lua

changeset 1033
589244a349f6
parent 1022
d509e282ae10
child 1035
e46ff6e45c96
equal deleted inserted replaced
1032:b0497894f69b 1033:589244a349f6
37 completeopt = "menu,menuone,noinsert,noselect", 37 completeopt = "menu,menuone,noinsert,noselect",
38 }, 38 },
39 mapping = cmp.mapping.preset.insert({ 39 mapping = cmp.mapping.preset.insert({
40 ["<C-b>"] = cmp.mapping.scroll_docs(-4), 40 ["<C-b>"] = cmp.mapping.scroll_docs(-4),
41 ["<C-f>"] = cmp.mapping.scroll_docs(4), 41 ["<C-f>"] = cmp.mapping.scroll_docs(4),
42 ["<Tab>"] = cmp.mapping.select_next_item(), 42 ["<Tab>"] = function(fallback)
43 if cmp.visible() then
44 cmp.select_next_item()
45 else
46 cmp.complete()
47 end
48 end,
43 ["<S-Tab>"] = cmp.mapping.select_prev_item(), 49 ["<S-Tab>"] = cmp.mapping.select_prev_item(),
44 ["<C-g>"] = cmp.mapping.abort(), 50 ["<C-g>"] = cmp.mapping.abort(),
45 -- FIXME: add extra space after in select case?
46 ["<Space>"] = cmp.mapping.confirm({select = false}),
47 ["<Right>"] = cmp.mapping.confirm({select = true}), 51 ["<Right>"] = cmp.mapping.confirm({select = true}),
52 ["<Space>"] = function(fallback)
53 if cmp.visible() then
54 cmp.confirm({select = false})
55 vim.api.nvim_feedkeys(" ", "n", false)
56 end
57 fallback()
58 end,
48 }), 59 }),
49 sources = cmp.config.sources({ 60 sources = cmp.config.sources({
50 { name = "nvim_lsp" }, 61 { name = "nvim_lsp" },
51 { name = "nvim_lsp_signature_help" }, 62 { name = "nvim_lsp_signature_help" },
52 { name = "nvim_lua" }, 63 { name = "nvim_lua" },
64 }, {
53 { name = "buffer" }, 65 { name = "buffer" },
54 { name = "path" }, 66 { name = "path" },
55 }), 67 }),
56 experimental = { 68 experimental = {
57 ghost_text = { 69 ghost_text = {

mercurial