summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <56338480+adastx@users.noreply.github.com>2021-10-15 22:06:05 +0200
committerAdam <56338480+adastx@users.noreply.github.com>2021-10-15 22:37:37 +0200
commit042c33293f9e581c6f2cfdb3f1c06a50e4583c1a (patch)
tree6fd6665bcb914ebade8d09e2fa448ccf4d2e4a83
parent093660fb3381fca8c2568f6a2a13501f8dd5d37f (diff)
Nvim setup autopairs
-rw-r--r--.config/nvim/lua/opts.lua20
-rw-r--r--.config/nvim/lua/plugins.lua1
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 {
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-e>'] = cmp.mapping.close(),
- ['<CR>'] = cmp.mapping.confirm {
- behavior = cmp.ConfirmBehavior.Replace,
- select = true,
- },
+ -- ['<CR>'] = cmp.mapping.confirm {
+ -- behavior = cmp.ConfirmBehavior.Replace,
+ -- select = true,
+ -- },
["<Tab>"] = cmp.mapping(function(fallback)
if vim.fn["UltiSnips#CanJumpForwards"]() == 1 then
vim.fn.feedkeys(t("<ESC>:call UltiSnips#JumpForwards()<CR>"))
@@ -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 <CR> 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',