diff options
Diffstat (limited to 'lua/config/nvim-cmp.lua')
| -rw-r--r-- | lua/config/nvim-cmp.lua | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua index e7fed19..188c985 100644 --- a/lua/config/nvim-cmp.lua +++ b/lua/config/nvim-cmp.lua @@ -1,54 +1,54 @@ -- Setup nvim-cmp. -local cmp = require'cmp' -local lspkind = require'lspkind' +local cmp = require("cmp") +local lspkind = require("lspkind") -cmp.setup({ +cmp.setup { snippet = { expand = function(args) -- For `ultisnips` user. vim.fn["UltiSnips#Anon"](args.body) end, }, - mapping = cmp.mapping.preset.insert({ - ['<Tab>'] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - ['<S-Tab>'] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, - ['<CR>'] = cmp.mapping.confirm({ select = true }), - ['<C-e>'] = cmp.mapping.abort(), - ['<Esc>'] = cmp.mapping.close(), - ['<C-d>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - }), + mapping = cmp.mapping.preset.insert { + ["<Tab>"] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, + ["<S-Tab>"] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, + ["<CR>"] = cmp.mapping.confirm { select = true }, + ["<C-e>"] = cmp.mapping.abort(), + ["<Esc>"] = cmp.mapping.close(), + ["<C-d>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + }, sources = { - { name = 'nvim_lsp' }, -- For nvim-lsp - { name = 'ultisnips' }, -- For ultisnips user. - { name = 'path' }, -- for path completion - { name = 'buffer', keyword_length = 2 }, -- for buffer word completion - { name = 'omni' }, - { name = 'emoji', insert = true, } -- emoji completion + { name = "nvim_lsp" }, -- For nvim-lsp + { name = "ultisnips" }, -- For ultisnips user. + { name = "path" }, -- for path completion + { name = "buffer", keyword_length = 2 }, -- for buffer word completion + { name = "omni" }, + { name = "emoji", insert = true }, -- emoji completion }, completion = { keyword_length = 1, - completeopt = "menu,noselect" + completeopt = "menu,noselect", }, view = { - entries = 'custom', + entries = "custom", }, formatting = { - format = lspkind.cmp_format({ + format = lspkind.cmp_format { mode = "symbol_text", - menu = ({ + menu = { nvim_lsp = "[LSP]", ultisnips = "[US]", nvim_lua = "[Lua]", @@ -56,13 +56,13 @@ cmp.setup({ buffer = "[Buffer]", emoji = "[Emoji]", omni = "[Omni]", - }), - }), + }, + }, }, -}) +} -- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu -vim.cmd[[ +vim.cmd([[ highlight! link CmpItemMenu Comment " gray highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080 @@ -80,4 +80,4 @@ vim.cmd[[ highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4 highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4 highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4 -]] +]]) |
