Hi, I’m trying to get a key binding to only add a semicolon to the end of the line when it there isn’t one there already. I’m playing around with detection and I have something like
{ "keys": ["ctrl+shift+enter"], "command": "insert", "args": {"characters": "hi"}, "context": [
{"key": "preceding_text", "operator": "regex_match", "operand": "^.*", "match_all": true},
{"key": "following_text", "operator:": "regex_match", "operand": ".*;$", "match_all": true}
]
},
Based off of the regex, it should only insert “hi” when there is a semicolon at the end, but it doesn’t seem to be working and defaults to the original command. I’m not sure what I am doing wrong, unless “following_text” doesn’t match up until the end of the line.