mirror of
https://github.com/ilyakooo0/nvim-autopairs.git
synced 2024-09-11 07:15:44 +03:00
fix: afterquote
It will better it is automatic add pair for quote when only have quote in line some kind of noisy because we can remove map pair easy
This commit is contained in:
parent
e599e15f94
commit
b0bbe8d908
@ -431,7 +431,7 @@ M.autopairs_afterquote = function(line, key_char)
|
|||||||
and not utils.is_in_quote(line, col, next_char)
|
and not utils.is_in_quote(line, col, next_char)
|
||||||
then
|
then
|
||||||
local is_prev_slash = false
|
local is_prev_slash = false
|
||||||
for i = col + 2 + #next_char, #line, 1 do
|
for i = #line - 2, #line, 1 do
|
||||||
local char = line:sub(i, i + #next_char - 1)
|
local char = line:sub(i, i + #next_char - 1)
|
||||||
local char_end = line:sub(i + 1, i + #next_char)
|
local char_end = line:sub(i + 1, i + #next_char)
|
||||||
if not is_prev_slash and char == next_char then
|
if not is_prev_slash and char == next_char then
|
||||||
|
@ -5,6 +5,7 @@ _G.npairs = npairs
|
|||||||
npairs.setup({
|
npairs.setup({
|
||||||
enable_afterquote = true,
|
enable_afterquote = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
{
|
{
|
||||||
name = 'add bracket after quote ',
|
name = 'add bracket after quote ',
|
||||||
@ -88,7 +89,7 @@ local data = {
|
|||||||
linenr = '5',
|
linenr = '5',
|
||||||
key = [[(]],
|
key = [[(]],
|
||||||
before = [[|"data", "abcdef"]],
|
before = [[|"data", "abcdef"]],
|
||||||
after = [[(|"data", "abcdef"]],
|
after = [[(|"data", "abcdef")]],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user