diff options
Diffstat (limited to 'lua/plugins/opts/cmp.lua')
-rw-r--r-- | lua/plugins/opts/cmp.lua | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/lua/plugins/opts/cmp.lua b/lua/plugins/opts/cmp.lua index c423a31..65e48b5 100644 --- a/lua/plugins/opts/cmp.lua +++ b/lua/plugins/opts/cmp.lua @@ -1,96 +1,96 @@ -local cmp = require "cmp" -local lspzero_cmp_act = require('lsp-zero').cmp_action() +local cmp = require("cmp") +local lspzero_cmp_act = require("lsp-zero").cmp_action() local function border(hl_name) - return { - { "╭", hl_name }, - { "─", hl_name }, - { "╮", hl_name }, - { "│", hl_name }, - { "╯", hl_name }, - { "─", hl_name }, - { "╰", hl_name }, - { "│", hl_name }, - } + return { + { "╭", hl_name }, + { "─", hl_name }, + { "╮", hl_name }, + { "│", hl_name }, + { "╯", hl_name }, + { "─", hl_name }, + { "╰", hl_name }, + { "│", hl_name }, + } end local options = { - completion = { - completeopt = "menu,menuone", - }, + completion = { + completeopt = "menu,menuone", + }, - window = { - completion = { - border = border "CmpBorder", - winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,CursorLine:PmenuSel", - scrollbar = false, - }, - documentation = { - border = border "CmpDocBorder", - winhighlight = "Normal:CmpDoc", - }, - }, + window = { + completion = { + border = border("CmpBorder"), + winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,CursorLine:PmenuSel", + scrollbar = false, + }, + documentation = { + border = border("CmpDocBorder"), + winhighlight = "Normal:CmpDoc", + }, + }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, - formatting = { - fields = { "abbr", "kind", "menu" }, + formatting = { + fields = { "abbr", "kind", "menu" }, - format = function(_, item) - local icons = { - Text = " ", - Method = " ", - Function = " ", - Constructor = " ", - Field = " ", - Variable = " ", - Class = " ", - Interface = " ", - Module = " ", - Property = " ", - Unit = " ", - Value = " ", - Enum = " ", - Keyword = " ", - Snippet = " ", - Color = " ", - File = " ", - Reference = " ", - Folder = " ", - EnumMember = " ", - Constant = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", - } + format = function(_, item) + local icons = { + Text = " ", + Method = " ", + Function = " ", + Constructor = " ", + Field = " ", + Variable = " ", + Class = " ", + Interface = " ", + Module = " ", + Property = " ", + Unit = " ", + Value = " ", + Enum = " ", + Keyword = " ", + Snippet = " ", + Color = " ", + File = " ", + Reference = " ", + Folder = " ", + EnumMember = " ", + Constant = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + } - local icon = icons[item.kind] or "" - item.kind = string.format(" %s %s", icon, item.kind) + local icon = icons[item.kind] or "" + item.kind = string.format(" %s %s", icon, item.kind) - return item - end, - }, + return item + end, + }, - mapping = cmp.mapping.preset.insert({ - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-u>'] = cmp.mapping.scroll_docs(-4), - ['<C-d>'] = cmp.mapping.scroll_docs(4), - ['<C-f>'] = lspzero_cmp_act.luasnip_jump_forward(), - ['<C-b>'] = lspzero_cmp_act.luasnip_jump_backward(), - }), + mapping = cmp.mapping.preset.insert({ + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-u>"] = cmp.mapping.scroll_docs(-4), + ["<C-d>"] = cmp.mapping.scroll_docs(4), + ["<C-f>"] = lspzero_cmp_act.luasnip_jump_forward(), + ["<C-b>"] = lspzero_cmp_act.luasnip_jump_backward(), + }), - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "nvim_lua" }, - { name = "path" }, - }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "nvim_lua" }, + { name = "path" }, + }, } return options |