.config/nvim/lua/plugins/completion.lua

changeset 1168
52750027eff6
parent 1148
bca491e2be91
child 1171
12363689e67e
equal deleted inserted replaced
1167:f5f84f890974 1168:52750027eff6
61 else 61 else
62 fallback() 62 fallback()
63 end 63 end
64 end, { "i", "s" }), 64 end, { "i", "s" }),
65 ["<C-g>"] = cmp.mapping.abort(), 65 ["<C-g>"] = cmp.mapping.abort(),
66 ["<Right>"] = cmp.mapping.confirm({ select = true }),
67 ["<C-Space>"] = cmp.mapping.complete(), 66 ["<C-Space>"] = cmp.mapping.complete(),
68 ["<Space>"] = function(fallback) 67 ["<Space>"] = cmp.mapping(function(fallback)
69 local e = cmp.get_active_entry() 68 cmp.confirm({ select = false })
70 if cmp.visible() and e then
71 cmp.confirm({ select = false }, function()
72 if e:get_kind() ~= cmp.lsp.CompletionItemKind.Snippet then
73 vim.api.nvim_feedkeys(" ", "n", false)
74 end
75 end)
76 end
77 fallback() 69 fallback()
78 end, 70 end, { "i", "s" }),
79 }), 71 }),
80 sources = cmp.config.sources({ 72 sources = cmp.config.sources({
81 { name = "nvim_lsp" }, 73 { name = "nvim_lsp" },
82 { name = "nvim_lua" }, 74 { name = "nvim_lua" },
83 { name = "buffer", option = { keyword_pattern = [[\k\+]] } }, 75 { name = "buffer", option = { keyword_pattern = [[\k\+]] } },

mercurial