From 27f1cf535c25e91667acf2c13db6c871ed28e0b0 Mon Sep 17 00:00:00 2001 From: philw Date: Wed, 15 Jan 2025 16:12:18 +0100 Subject: Rewrite autopairs feature --- init.lua | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index bf8f2f2..b1e8359 100644 --- a/init.lua +++ b/init.lua @@ -99,6 +99,28 @@ function ToggleVExplorer() end end + + +local function setup_autopairs() + local autopairs = { + ["("] = ")", + ["["] = "]", + ["{"] = "}", + ["<"] = ">", + } + + for open, close in pairs(autopairs) do + vim.api.nvim_set_keymap( + 'i', + open, + open .. close .. "", + { noremap = true, silent = true } + ) + end +end + +setup_autopairs() + local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system( @@ -119,14 +141,12 @@ require("lazy").setup( {"airblade/vim-gitgutter"}, {"norcalli/nvim-colorizer.lua"}, {"nvim-treesitter/nvim-treesitter"}, - {'echasnovski/mini.nvim', version = false}, { "neovim/nvim-lspconfig", lazy = false, dependencies = { {"ms-jpq/coq_nvim", branch = "coq"}, {"ms-jpq/coq.artifacts", branch = "artifacts"}, - -- {"ms-jpq/coq.thirdparty", branch = "3p"}, {"williamboman/mason.nvim"}, {"williamboman/mason-lspconfig.nvim"} }, @@ -148,7 +168,6 @@ require("lazy").setup( } ) require("colorizer").setup() -require('mini.pairs').setup() vim.api.nvim_create_autocmd( "BufWritePre", -- cgit v1.2.3