Home Download Buy Blog Forum Support

regexes and contexts

Re: regexes and contexts

Postby pierre on Wed Mar 23, 2011 11:51 pm

Well, actually, to be precise.

This works correctly: when I press 'a' at beginning of line or
after a space, \alpha is inserted:
{
"keys": ["a"],
"command": "insert_snippet",
"args": {"contents": "\\alpha"},
"context":
[
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^$|.*?\\s$" }
]
}

But this does not work: if I press 'a' and then 'b' nothing happens:
{
"keys": ["a", "b"],
"command": "insert_snippet",
"args": {"contents": "\\alpha"},
"context":
[
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^$|.*?\\s$" }
]
}

So the problem is with multiple key bindings. If I remove
the $ character from the regex, the binding works, but
it captures any space and not only a space before the
cursor. Is this the expected behaviour?
pierre
 
Posts: 28
Joined: Sat Mar 19, 2011 8:47 pm

Previous

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 14 guests