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

changeset 1174
753971334371
parent 1173
79c1553aa040
equal deleted inserted replaced
1173:79c1553aa040 1174:753971334371
5 event = "InsertEnter", 5 event = "InsertEnter",
6 dependencies = { 6 dependencies = {
7 "hrsh7th/cmp-buffer", 7 "hrsh7th/cmp-buffer",
8 "hrsh7th/cmp-calc", 8 "hrsh7th/cmp-calc",
9 "hrsh7th/cmp-nvim-lsp", 9 "hrsh7th/cmp-nvim-lsp",
10 "hrsh7th/cmp-nvim-lua",
11 "hrsh7th/cmp-path", 10 "hrsh7th/cmp-path",
12 "quangnguyen30192/cmp-nvim-tags", 11 "quangnguyen30192/cmp-nvim-tags",
13 }, 12 },
14 config = function() 13 config = function()
15 local cmp = require("cmp") 14 local cmp = require("cmp")
27 snippet = { 26 snippet = {
28 expand = function(args) 27 expand = function(args)
29 vim.snippet.expand(args.body) 28 vim.snippet.expand(args.body)
30 end, 29 end,
31 }, 30 },
31 ---@diagnostic disable-next-line: missing-fields
32 formatting = { 32 formatting = {
33 format = function(entry, vim_item) 33 format = function(entry, vim_item)
34 if vim_item.kind == "Text" then 34 if vim_item.kind == "Text" then
35 vim_item.kind = entry.source.name 35 vim_item.kind = entry.source.name
36 end 36 end
67 cmp.confirm({ select = false }) 67 cmp.confirm({ select = false })
68 fallback() 68 fallback()
69 end, { "i", "s" }), 69 end, { "i", "s" }),
70 }), 70 }),
71 sources = cmp.config.sources({ 71 sources = cmp.config.sources({
72 { name = "lazydev" },
73 }, {
72 { name = "nvim_lsp" }, 74 { name = "nvim_lsp" },
73 { name = "nvim_lua" }, 75 }, {
74 { name = "buffer", option = { keyword_pattern = [[\k\+]] } }, 76 { name = "buffer", option = { keyword_pattern = [[\k\+]] } },
75 { name = "path" }, 77 { name = "path" },
78 }, {
76 { name = "tags" }, 79 { name = "tags" },
77 { name = "calc" }, 80 { name = "calc" },
78 }), 81 }),
79 }) 82 })
80 end, 83 end,

mercurial