fix: remove auto pairs /^>

This commit is contained in:
asep komarudin 2024-02-19 14:36:43 +07:00
parent 2af9f21559
commit d3d7d566da
2 changed files with 10 additions and 9 deletions

View file

@ -32,6 +32,7 @@
"nvim-autopairs": { "branch": "master", "commit": "2e8a10c5fc0dcaf8296a5f1a7077efcd37065cc8" }, "nvim-autopairs": { "branch": "master", "commit": "2e8a10c5fc0dcaf8296a5f1a7077efcd37065cc8" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" },
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" }, "nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
"nvim-lspconfig": { "branch": "master", "commit": "cf3dd4a290084a868fac0e2e876039321d57111c" }, "nvim-lspconfig": { "branch": "master", "commit": "cf3dd4a290084a868fac0e2e876039321d57111c" },
"nvim-material-icon": { "branch": "main", "commit": "602088c2682e61cbebd7191de7dc88bfa90c6890" }, "nvim-material-icon": { "branch": "main", "commit": "602088c2682e61cbebd7191de7dc88bfa90c6890" },

View file

@ -4,7 +4,7 @@ if not status_ok then
return return
end end
local Rule = require("nvim-autopairs.rule") -- local Rule = require("nvim-autopairs.rule")
npairs.setup({ npairs.setup({
check_ts = true, check_ts = true,
@ -27,14 +27,14 @@ npairs.setup({
}, },
}) })
npairs.add_rules({ -- npairs.add_rules({
Rule("/", ">"):with_pair(function(opts) -- Rule("/", ">"):with_pair(function(opts)
local pair = opts.line:sub(opts.col, opts.col + 1) -- local pair = opts.line:sub(opts.col, opts.col + 1)
if (vim.bo.filetype == "jsx" or vim.bo.filetype == "tsx") and pair == "/" then -- if (vim.bo.filetype == "jsx" or vim.bo.filetype == "tsx") and pair == "/" then
return npairs.esc("/>") .. "<esc>i" -- return npairs.esc("/>") .. "<esc>i"
end -- end
end), -- end),
}) -- })
-- If you want insert `(` after select function or method item -- If you want insert `(` after select function or method item
local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_status_ok, cmp = pcall(require, "cmp") local cmp_status_ok, cmp = pcall(require, "cmp")