Skip to content

Instantly share code, notes, and snippets.

@saravanak
Created December 21, 2015 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saravanak/d7f1cca7f831bd7a6b5d to your computer and use it in GitHub Desktop.
Save saravanak/d7f1cca7f831bd7a6b5d to your computer and use it in GitHub Desktop.
#http://wiki.yangleo.me/2013/10/29/write-UltiSnips-snippets.html
# this snippet creates a step definition out of a feature definiton
# only inconvinience is that this one displays the args list as a new line.
# not sure how to deal with this anyhow
snippet step "create step from feature description"
`!p num_replaced = re.sub(r'\d+', '(\d+)', snip.v.text)
quote_replaced = re.sub(r'".*"','"([^"]*)"', num_replaced)
snip.rv = re.sub(r'^\s*(Then|Given)\s*(.*)',r'\1(/^\2$/) do ', quote_replaced)`|${0:arg1}|
end
endsnippet
snippet text "text_regex"
"([^"]*)"
endsnippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment