diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-31 09:44:13 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-31 09:44:13 +0100 |
| commit | 669561e21073e6efafddda25ba3ace69fb43819e (patch) | |
| tree | f94ebd60ad4cab480b5cbcb7e65dd2060696c339 /lua/alpha/completition/init.lua | |
| parent | 5044c70e9f62cdd06ee91e754423b07c1c18c12d (diff) | |
| download | nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.tar.gz nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.zip | |
feat: apply stylua
Diffstat (limited to 'lua/alpha/completition/init.lua')
| -rw-r--r-- | lua/alpha/completition/init.lua | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/lua/alpha/completition/init.lua b/lua/alpha/completition/init.lua index 2951608..9955d4e 100644 --- a/lua/alpha/completition/init.lua +++ b/lua/alpha/completition/init.lua @@ -1,127 +1,127 @@ -local cmp = require("cmp") -local lspkind = require("lspkind") -local luasnip = require("luasnip") -local cmp_autopairs = require("nvim-autopairs.completion.cmp") -local compare = require('cmp.config.compare') +local cmp = require "cmp" +local lspkind = require "lspkind" +local luasnip = require "luasnip" +local cmp_autopairs = require "nvim-autopairs.completion.cmp" +local compare = require "cmp.config.compare" -cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) -cmp.setup({ - mapping = { - ["<C-d>"] = cmp.mapping.scroll_docs(-4), - ["<C-f>"] = cmp.mapping.scroll_docs(4), - ["<C-e>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.close() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - ["<C-n>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.choice_active() then - luasnip.change_choice(1) - else - fallback() - end - end, { "i", "s" }), - ["<C-p>"] = cmp.mapping.select_prev_item(), - ["<C-y>"] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }), - ["<c-space>"] = cmp.mapping.complete(), - }, - sources = { - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "path" }, - { name = "luasnip" }, - { name = 'nvim_lsp_signature_help' }, - { - name = "buffer", - keyword_length = 4, - option = { - get_bufnrs = function() - local bufs = {} - for _, win in ipairs(vim.api.nvim_list_wins()) do - bufs[vim.api.nvim_win_get_buf(win)] = true - end - return vim.tbl_keys(bufs) - end, - }, - }, - }, +cmp.setup { + mapping = { + ["<C-d>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + ["<C-e>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.close() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + ["<C-n>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.choice_active() then + luasnip.change_choice(1) + else + fallback() + end + end, { "i", "s" }), + ["<C-p>"] = cmp.mapping.select_prev_item(), + ["<C-y>"] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }, + ["<c-space>"] = cmp.mapping.complete(), + }, + sources = { + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "path" }, + { name = "luasnip" }, + { name = "nvim_lsp_signature_help" }, + { + name = "buffer", + keyword_length = 4, + option = { + get_bufnrs = function() + local bufs = {} + for _, win in ipairs(vim.api.nvim_list_wins()) do + bufs[vim.api.nvim_win_get_buf(win)] = true + end + return vim.tbl_keys(bufs) + end, + }, + }, + }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, - formatting = { - format = lspkind.cmp_format({ - with_text = true, - menu = { - buffer = "[buf]", - nvim_lsp = "[LSP]", - nvim_lua = "[api]", - path = "[path]", - luasnip = "[snip]", - ["vim-dadbod-completion"] = "[DB]", - }, - }), - }, + formatting = { + format = lspkind.cmp_format { + with_text = true, + menu = { + buffer = "[buf]", + nvim_lsp = "[LSP]", + nvim_lua = "[api]", + path = "[path]", + luasnip = "[snip]", + ["vim-dadbod-completion"] = "[DB]", + }, + }, + }, - sorting = { - priority_weight = 2, - comparators = { - compare.kind, - compare.sort_text, - } - }, + sorting = { + priority_weight = 2, + comparators = { + compare.kind, + compare.sort_text, + }, + }, - experimental = { - native_menu = false, + experimental = { + native_menu = false, - ghost_text = true, - }, -}) + ghost_text = true, + }, +} -- Set configuration for specific filetype. cmp.setup.filetype("gitcommit", { - sources = cmp.config.sources({ - { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it. - }, { - { name = "buffer" }, - }), + sources = cmp.config.sources({ + { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it. + }, { + { name = "buffer" }, + }), }) -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline("/", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, }) -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), }) cmp.setup.filetype({ "sql", "mysql", "plsql" }, { - sources = cmp.config.sources({ - { name = "vim-dadbod-completion" }, - }, { - { name = "buffer" }, - }), + sources = cmp.config.sources({ + { name = "vim-dadbod-completion" }, + }, { + { name = "buffer" }, + }), }) |