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\+]] } }, |