summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorAdam <adam.moloney.stuck@gmail.com>2021-10-15 22:06:05 +0200
committeradamstuck <adam.moloney.stuck@gmail.com>2021-10-17 18:00:24 +0200
commited39ec8685f47af72ec149f366be42baa1b801ad (patch)
tree313b6d9db8ae36967f8c46ca8dc9101b93dba6e3 /.config/nvim
parent38949564a4325616be0c3b2b67e693db3a62b88f (diff)
Nvim setup autopairs
Diffstat (limited to '.config/nvim')
-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',