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

changeset 1043
e55463fb35e2
parent 1035
e46ff6e45c96
child 1044
8b90bfdedd2b
equal deleted inserted replaced
1042:0d793459267d 1043:e55463fb35e2
23 { 23 {
24 "hrsh7th/nvim-cmp", 24 "hrsh7th/nvim-cmp",
25 event = "InsertEnter", 25 event = "InsertEnter",
26 dependencies = { 26 dependencies = {
27 "hrsh7th/cmp-buffer", 27 "hrsh7th/cmp-buffer",
28 "hrsh7th/cmp-path", 28 "hrsh7th/cmp-calc",
29 "hrsh7th/cmp-nvim-lsp", 29 "hrsh7th/cmp-nvim-lsp",
30 "hrsh7th/cmp-nvim-lsp-signature-help", 30 "hrsh7th/cmp-nvim-lsp-signature-help",
31 "hrsh7th/cmp-nvim-lua", 31 "hrsh7th/cmp-nvim-lua",
32 "hrsh7th/cmp-omni",
33 "hrsh7th/cmp-path",
34 "quangnguyen30192/cmp-nvim-tags",
32 }, 35 },
33 opts = function() 36 opts = function()
34 local cmp = require("cmp") 37 local cmp = require("cmp")
35 return { 38 return {
36 completion = { 39 completion = {
37 completeopt = "menu,menuone,noinsert,noselect", 40 completeopt = "menu,menuone,noinsert,noselect",
38 }, 41 },
39 mapping = cmp.mapping.preset.insert({ 42 mapping = cmp.mapping.preset.insert({
40 ["<C-b>"] = cmp.mapping.scroll_docs(-4), 43 ["<C-b>"] = cmp.mapping.scroll_docs(-4),
41 ["<C-f>"] = cmp.mapping.scroll_docs(4), 44 ["<C-f>"] = cmp.mapping.scroll_docs(4),
42 ["<Tab>"] = function(fallback) 45 ["<Tab>"] = cmp.mapping.select_next_item(),
43 if cmp.visible() then
44 cmp.select_next_item()
45 else
46 cmp.complete()
47 end
48 end,
49 ["<S-Tab>"] = cmp.mapping.select_prev_item(), 46 ["<S-Tab>"] = cmp.mapping.select_prev_item(),
50 ["<C-g>"] = cmp.mapping.abort(), 47 ["<C-g>"] = cmp.mapping.abort(),
51 ["<Right>"] = cmp.mapping.confirm({select = true}), 48 ["<Right>"] = cmp.mapping.confirm({select = true}),
52 ["<Space>"] = function(fallback) 49 ["<Space>"] = function(fallback)
53 if cmp.visible() then 50 if cmp.visible() then
61 sources = cmp.config.sources({ 58 sources = cmp.config.sources({
62 { name = "nvim_lsp" }, 59 { name = "nvim_lsp" },
63 { name = "nvim_lsp_signature_help" }, 60 { name = "nvim_lsp_signature_help" },
64 { name = "nvim_lua" }, 61 { name = "nvim_lua" },
65 }, { 62 }, {
63 { name = "calc" },
66 { name = "buffer" }, 64 { name = "buffer" },
67 { name = "path" }, 65 { name = "path" },
66 }, {
67 { name = "tags" },
68 { name = "omni" },
68 }), 69 }),
69 experimental = {
70 ghost_text = {
71 hl_group = "LspCodeLens",
72 },
73 },
74 } 70 }
75 end, 71 end,
76 }, 72 },
77 } 73 }

mercurial