Skip to content

Commit 4d7eafa

Browse files
committed
bugfix for autopair
1 parent 670da88 commit 4d7eafa

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lua/easycomplete/autocmd.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
local util = require "easycomplete.util"
2+
local console = util.console
13
local autopair = require "easycomplete.autopair"
24
local M = {}
35

@@ -27,10 +29,9 @@ function M.init_once()
2729

2830
if vim.g.AutoPairsMapSpace and vim.g.AutoPairsMapSpace == 1 then
2931
vim.on_key(function(keys, _)
30-
if vim.api.nvim_get_mode().mode == "c" then
31-
return
32+
if vim.api.nvim_get_mode().mode == "c" and vim.fn.getcmdtype() == "=" then
33+
autopair.hack_pair_input(keys)
3234
end
33-
autopair.hack_pair_input(keys)
3435
end)
3536
end
3637
end

lua/easycomplete/autopair.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local console = util.console
44
local M = {}
55
local input_chars_vec = {}
66
local auto_pair_funcs = {
7-
"=AutoPairsInsert("
7+
"AutoPairsInsert("
88
}
99

1010
local function match_autopair_func()
@@ -16,6 +16,9 @@ local function match_autopair_func()
1616
break
1717
end
1818
end
19+
if matched then
20+
input_chars_vec = {}
21+
end
1922
return matched
2023
end
2124

0 commit comments

Comments
 (0)