17 }) |
17 }) |
18 end |
18 end |
19 }) |
19 }) |
20 end, |
20 end, |
21 }, |
21 }, |
22 |
|
23 { |
|
24 "hrsh7th/nvim-cmp", |
|
25 event = "InsertEnter", |
|
26 dependencies = { |
|
27 "hrsh7th/cmp-buffer", |
|
28 "hrsh7th/cmp-calc", |
|
29 "hrsh7th/cmp-nvim-lsp", |
|
30 "hrsh7th/cmp-nvim-lsp-signature-help", |
|
31 "hrsh7th/cmp-nvim-lua", |
|
32 "hrsh7th/cmp-omni", |
|
33 "hrsh7th/cmp-path", |
|
34 "quangnguyen30192/cmp-nvim-tags", |
|
35 }, |
|
36 opts = function() |
|
37 local cmp = require("cmp") |
|
38 return { |
|
39 completion = { |
|
40 completeopt = "menu,menuone,noinsert,noselect", |
|
41 }, |
|
42 mapping = cmp.mapping.preset.insert({ |
|
43 ["<C-b>"] = cmp.mapping.scroll_docs(-4), |
|
44 ["<C-f>"] = cmp.mapping.scroll_docs(4), |
|
45 ["<Tab>"] = cmp.mapping.select_next_item(), |
|
46 ["<S-Tab>"] = cmp.mapping.select_prev_item(), |
|
47 ["<C-g>"] = cmp.mapping.abort(), |
|
48 ["<Right>"] = cmp.mapping.confirm({select = true}), |
|
49 ["<Space>"] = function(fallback) |
|
50 if cmp.visible() then |
|
51 cmp.confirm({select = false}, function() |
|
52 vim.api.nvim_feedkeys(" ", "n", false) |
|
53 end) |
|
54 end |
|
55 fallback() |
|
56 end, |
|
57 }), |
|
58 sources = cmp.config.sources({ |
|
59 { name = "nvim_lsp" }, |
|
60 { name = "nvim_lsp_signature_help" }, |
|
61 { name = "nvim_lua" }, |
|
62 }, { |
|
63 { name = "calc" }, |
|
64 { name = "buffer" }, |
|
65 { name = "path" }, |
|
66 }, { |
|
67 { name = "tags" }, |
|
68 { name = "omni" }, |
|
69 }), |
|
70 } |
|
71 end, |
|
72 }, |
|
73 } |
22 } |