From 042c33293f9e581c6f2cfdb3f1c06a50e4583c1a Mon Sep 17 00:00:00 2001 From: Adam <56338480+adastx@users.noreply.github.com> Date: Fri, 15 Oct 2021 22:06:05 +0200 Subject: Nvim setup autopairs --- .config/nvim/lua/opts.lua | 20 ++++++++++++++++---- .config/nvim/lua/plugins.lua | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.config/nvim/lua/opts.lua b/.config/nvim/lua/opts.lua index a67a07a..157c899 100644 --- a/.config/nvim/lua/opts.lua +++ b/.config/nvim/lua/opts.lua @@ -30,10 +30,10 @@ cmp.setup { [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, + -- [''] = cmp.mapping.confirm { + -- behavior = cmp.ConfirmBehavior.Replace, + -- select = true, + -- }, [""] = cmp.mapping(function(fallback) if vim.fn["UltiSnips#CanJumpForwards"]() == 1 then vim.fn.feedkeys(t(":call UltiSnips#JumpForwards()")) @@ -56,6 +56,18 @@ cmp.setup { } vim.cmd('autocmd FileType markdown lua require("cmp").setup.buffer { enabled = false }') +require('nvim-autopairs').setup{} +require("nvim-autopairs.completion.cmp").setup { + map_cr = true, -- map on insert mode + map_complete = true, -- it will auto insert `(` (map_char) after select function or method item + auto_select = true, -- automatically select the first item + insert = false, -- use insert confirm behavior instead of replace + map_char = { -- modifies the function or method delimiter by filetypes + all = '(', + tex = '{', + }, +} + -- C# local pid = vim.fn.getpid() diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 4c73a72..c1a83c3 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -18,6 +18,7 @@ require('packer').startup(function() use "akinsho/toggleterm.nvim" use "ray-x/lsp_signature.nvim" use "lukas-reineke/indent-blankline.nvim" + use "windwp/nvim-autopairs" use { 'nvim-telescope/telescope.nvim', -- cgit v1.2.3-70-g09d2