diff options
| author | bh <qn+git@excalibur.computer> | 2026-04-09 15:46:00 +0800 |
|---|---|---|
| committer | bh <qn+git@excalibur.computer> | 2026-04-09 15:46:00 +0800 |
| commit | 6c81e38e15455fb3074d9d46c94ec2c951b5a382 (patch) | |
| tree | c103a81c733ff200b4114f3a1caee058c10f374e /lua/config/completion.lua | |
| parent | 0a67a5614c1716c8ccf46980e13826616aa70c28 (diff) | |
Fix indentation
Diffstat (limited to 'lua/config/completion.lua')
| -rw-r--r-- | lua/config/completion.lua | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/lua/config/completion.lua b/lua/config/completion.lua index 9d737db..6f32cdc 100644 --- a/lua/config/completion.lua +++ b/lua/config/completion.lua @@ -1,65 +1,65 @@ -- return a function for lazy.nvim return function() - local cmp = require("cmp") - local luasnip = require("luasnip") - local lspkind = require("lspkind") + local cmp = require("cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") - -- load friendly-snippets - require("luasnip.loaders.from_vscode").lazy_load() + -- load friendly-snippets + require("luasnip.loaders.from_vscode").lazy_load() - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - ["<C-b>"] = cmp.mapping.scroll_docs(-4), - ["<C-f>"] = cmp.mapping.scroll_docs(4), - ["<C-Space>"] = cmp.mapping.complete(), -- manual trigger - ["<CR>"] = cmp.mapping.confirm({ select = true }), - ["<Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - ["<S-Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "path" }, - { name = "luasnip" }, - }, { - { name = "buffer" }, - }), - formatting = { - format = lspkind.cmp_format({ with_text = true, maxwidth = 50 }), - }, - window = { - completion = cmp.config.window.bordered({ - border = "rounded", - winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", - }), - documentation = cmp.config.window.bordered({ - border = "rounded", - winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", - }), - }, - completion = { - autocomplete = false, -- only trigger with <C-Space> - }, - }) + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ["<C-b>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + ["<C-Space>"] = cmp.mapping.complete(), -- manual trigger + ["<CR>"] = cmp.mapping.confirm({ select = true }), + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "path" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + }), + formatting = { + format = lspkind.cmp_format({ with_text = true, maxwidth = 50 }), + }, + window = { + completion = cmp.config.window.bordered({ + border = "rounded", + winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", + }), + documentation = cmp.config.window.bordered({ + border = "rounded", + winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", + }), + }, + completion = { + autocomplete = false, -- only trigger with <C-Space> + }, + }) end |
