mirror of
https://github.com/ilyakooo0/nvim-autopairs.git
synced 2024-09-11 07:15:44 +03:00
fix html rule
This commit is contained in:
parent
fdeb794ee7
commit
4f7d7fc2b7
@ -547,7 +547,7 @@ M.autopairs_cr = function(bufnr)
|
||||
end
|
||||
if
|
||||
utils.is_equal(rule.start_pair, prev_char, rule.is_regex)
|
||||
and rule.end_pair == next_char
|
||||
and utils.is_equal(rule.end_pair, next_char, rule.is_regex)
|
||||
and rule:can_cr({
|
||||
ts_node = M.state.ts_node,
|
||||
check_endwise_ts = false,
|
||||
|
@ -40,9 +40,10 @@ local function setup(opt)
|
||||
bracket("(", ")"),
|
||||
bracket("[", "]"),
|
||||
bracket("{", "}"),
|
||||
Rule(">", "<",
|
||||
Rule(">[%w%s]*$", "^%s*</",
|
||||
{ 'html', 'typescript', 'typescriptreact', 'javascript' , 'javascriptreact', 'svelte', 'vue', 'xml'})
|
||||
:only_cr()
|
||||
:use_regex(true)
|
||||
}
|
||||
return rules
|
||||
end
|
||||
|
@ -32,7 +32,7 @@ M.is_close_bracket = function (char)
|
||||
return char == ")" or char == ']' or char == '}'
|
||||
end
|
||||
|
||||
M.is_equal = function (value,text, is_regex)
|
||||
M.is_equal = function (value, text, is_regex)
|
||||
if is_regex and string.match(text, value) then
|
||||
return true
|
||||
elseif text == value then
|
||||
|
@ -232,6 +232,20 @@ local data = {
|
||||
before = [[<div>|</div>]],
|
||||
after = [[</div>]]
|
||||
},
|
||||
{
|
||||
name = "breakline on < html with text" ,
|
||||
filetype = "html",
|
||||
key = [[<cr>]],
|
||||
before = [[<div> ads |</div>]],
|
||||
after = [[</div>]]
|
||||
},
|
||||
{
|
||||
name = "breakline on < html with space after cursor" ,
|
||||
filetype = "html",
|
||||
key = [[<cr>]],
|
||||
before = [[<div> ads | </div>]],
|
||||
after = [[ </div>]]
|
||||
},
|
||||
{
|
||||
name = "do not mapping on > html" ,
|
||||
filetype = "html",
|
||||
|
Loading…
Reference in New Issue
Block a user