diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2021-11-25 00:05:34 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2021-11-25 00:05:59 +0100 |
| commit | 412f51cd7ad4ce610ecaf13210b52709fb3e0232 (patch) | |
| tree | bf6475830cc0df42b671bf7ce9a1b33fe70f0e37 /lua/alpha/completition.lua | |
| parent | 31efe743072b868d4bb86ed709b85253db0b1f60 (diff) | |
| download | nvim-conf-412f51cd7ad4ce610ecaf13210b52709fb3e0232.tar.gz nvim-conf-412f51cd7ad4ce610ecaf13210b52709fb3e0232.zip | |
Move config to lua. Add laravel snippets
Diffstat (limited to 'lua/alpha/completition.lua')
| -rw-r--r-- | lua/alpha/completition.lua | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lua/alpha/completition.lua b/lua/alpha/completition.lua index d91dccc..98a2c86 100644 --- a/lua/alpha/completition.lua +++ b/lua/alpha/completition.lua @@ -3,6 +3,8 @@ lspkind.init() local luasnip = require("luasnip") local cmp = require "cmp" +local cmp_autopairs = require('nvim-autopairs.completion.cmp') +cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) cmp.setup { mapping = { @@ -17,6 +19,15 @@ cmp.setup { 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-y>"] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Insert, select = true, @@ -25,11 +36,10 @@ cmp.setup { }, sources = { { name = "nvim_lua" }, - { name = "nvim_lsp" }, { name = "path" }, { name = "luasnip" }, - { name = "buffer", keyword_length = 5 }, + { name = "buffer", keyword_length = 3 }, }, snippet = { @@ -41,11 +51,13 @@ cmp.setup { formatting = { format = lspkind.cmp_format { with_text = true, - buffer = "[buf]", - nvim_lsp = "[LSP]", - nvim_lua = "[api]", - path = "[path]", - luasnip = "[snip]", + menu = { + buffer = "[buf]", + nvim_lsp = "[LSP]", + nvim_lua = "[api]", + path = "[path]", + luasnip = "[snip]", + } } }, @@ -55,6 +67,12 @@ cmp.setup { ghost_text = true, } } +-- Setup lspconfig. + local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled. + require('lspconfig')['emmet_ls'].setup { + capabilities = capabilities + } -- local Group = require("colorbuddy.group").Group -- local g = require("colorbuddy.group").groups |