Skip to content

Commit

Permalink
add use_key for rule
Browse files Browse the repository at this point in the history
  • Loading branch information
windwp committed Jun 5, 2021
1 parent de252fa commit de99a68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
| with_del(cond) | add condition to check for delete pair event |
| only_cr(cond) | disable move,del and pair event Only use break line event |
| use_regex(bool,"<key>") | input pair use regex and trigger by key |
| use_key('<key>') | change trigger key |
| replace_endpair(function) | change a map pair with function |
| end_wise(cond) | use it on end_wise mode |

Expand Down
5 changes: 5 additions & 0 deletions lua/nvim-autopairs/rule.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ function Rule:use_regex(value,key_map)
return self
end

function Rule:use_key(key_map)
self.key_map = key_map or ""
return self
end

function Rule:get_end_pair(opts)
if self.end_pair_func then
return self.end_pair_func(opts)
Expand Down

0 comments on commit de99a68

Please sign in to comment.