atom / snippets

Atom snippets package
MIT License
205 stars 100 forks source link

supports regular expression? #252

Closed kudou closed 5 years ago

kudou commented 6 years ago

for example,I wants the word at the beginning of the line,and I use ^ or \b (Backspace, e.g. in C) or sth like it

'*':
  'test ':
    'prefix': 'test'
    'body': "^ echo $1| sed -n '/^[0-9]\+$/p'"
'*':
  'test ':
    'prefix': 'test'
    'body': "\b echo $1| sed -n '/^[0-9]\+$/p'"

they do not take effect,is there other ways ?

savetheclocktower commented 5 years ago

Not sure what this means. Are you saying that you want the snippet's output to start at the beginning of the line, no matter what the indentation level is when you invoke the snippet?

If so, this can't be done with a pure snippet, but could be done with a custom command which then inserts a snippet. Main drawback is that you'd have to invoke it via a keystroke rather than a snippet prefix.