aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/autopairs.lua
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2023-02-10 11:22:07 +0200
committersrdusr <trevorgray@srdusr.com>2023-02-10 11:22:07 +0200
commit7cee6e5a673defef72c803eca094d1247c31bb9c (patch)
tree1dbc97c5ece5f574ef5091d549fb434a8b59a625 /.config/nvim/lua/plugins/autopairs.lua
parentb91ee8da3ef2c1c154833b4b6e99250fe2c280e7 (diff)
parentf76f2c4bbc1ddde4b5c0882863060e4c58a11733 (diff)
downloaddotfiles-7cee6e5a673defef72c803eca094d1247c31bb9c.tar.gz
dotfiles-7cee6e5a673defef72c803eca094d1247c31bb9c.zip
Add '.config/nvim/' from commit 'e707f3abc83e0621eab64b4828defd0c80dff5c0'
git-subtree-dir: .config/nvim git-subtree-mainline: bb29321714929e1b7b962dd47b486325fd77e67a git-subtree-split: e707f3abc83e0621eab64b4828defd0c80dff5c0
Diffstat (limited to '.config/nvim/lua/plugins/autopairs.lua')
-rw-r--r--.config/nvim/lua/plugins/autopairs.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua
new file mode 100644
index 0000000..fc39d2e
--- /dev/null
+++ b/.config/nvim/lua/plugins/autopairs.lua
@@ -0,0 +1,43 @@
+-- Setup nvim-cmp.
+local status_ok, npairs = pcall(require, "nvim-autopairs")
+if not status_ok then
+ return
+end
+
+npairs.setup {
+ check_ts = true,
+ ts_config = {
+ lua = { "string", "source" },
+ javascript = { "string", "template_string" },
+ java = false,
+ },
+ map = "<M-e>",
+ pairs_map = {
+['<'] = '>',
+},
+ disable_filetype = { "TelescopePrompt", "spectre_panel" },
+ disable_in_macro = true,
+ disable_in_visualblock = true,
+ enalbe_moveright = true,
+ enable_afterquote = true, -- add bracket pairs after quote
+ enable_check_bracket_line = true, --- check bracket in same line
+ enable_bracket_in_quote = true, --
+ break_undo = true, -- switch for basic rule break undo sequence
+ fast_wrap = {
+ chars = { "{", "[", "(", '"', "'" },
+ pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
+ offset = 0, -- Offset from pattern match
+ end_key = "$",
+ keys = "qwertyuiopzxcvbnmasdfghjkl",
+ check_comma = true,
+ highlight = "PmenuSel",
+ highlight_grey = "LineNr",
+ },
+}
+
+local cmp_autopairs = require "nvim-autopairs.completion.cmp"
+local cmp_status_ok, cmp = pcall(require, "cmp")
+if not cmp_status_ok then
+ return
+end
+cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })