From 9a000ff4e8ff7ade9e83fa67c4a2dc356412afb1 Mon Sep 17 00:00:00 2001 From: "Radu C. Martin" Date: Fri, 13 Dec 2024 16:24:52 +0100 Subject: [PATCH] feat: add autopairs plugin --- lazy-lock.json | 1 + lua/plugins/autopairs.lua | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lua/plugins/autopairs.lua diff --git a/lazy-lock.json b/lazy-lock.json index bf48983..0f63238 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -14,6 +14,7 @@ "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.nvim": { "branch": "main", "commit": "2435d0de00174a45d6b352fefeaa6008ebe9f23b" }, + "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, "nvim-cmp": { "branch": "main", "commit": "3403e2e9391ed0a28c3afddd8612701b647c8e26" }, "nvim-lspconfig": { "branch": "master", "commit": "5a812abc65d529ea7673059a348814c21d7f87ff" }, "nvim-treesitter": { "branch": "master", "commit": "5874cac1b76c97ebb3fc03225bd7215d4e671cd2" }, diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua new file mode 100644 index 0000000..e28380c --- /dev/null +++ b/lua/plugins/autopairs.lua @@ -0,0 +1,29 @@ +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function + -- + opts = { + check_ts = true, + ts_config = { + lua = { 'string' }, -- it will not add a pair on that treesitter node + javascript = { 'template_string' }, + java = false, -- don't check treesitter on java + }, + fast_wrap = { + map = '', + chars = { '{', '[', '(', '"', "'" }, + pattern = [=[[%'%"%>%]%)%}%,]]=], + end_key = '$', + before_key = 'h', + after_key = 'l', + cursor_pos_before = true, + keys = 'qwertyuiopzxcvbnmasdfghjkl', + manual_position = true, + highlight = 'Search', + highlight_grey = 'Comment', + }, + }, +}