One of the code conventions at work is to include a padding of one space inside square brackets and parenthesis. So list[ index ]
, not list[index]
. Adding those spaces can be annoying, so I tried writing a snippet:
# name: Bracket
# key: [
# --
[ ${1:exp} ]
This works when the opening square bracket is preceded by a space or beginning of a line, but not when its preceded by an identifier. I think one way to do this would be to have the trigger be a regular expression:
# key: "[:ascii:]"[
Or something like that. Is this even possible? Or is there some other clever way to make this work? I'm writing this for python, but I think that shouldn't matter.
Thanks!
key: [
do anything? (So, make it:key:[
)? – Mutazilite