Let's say I have an UltiSnips snippet that shall replace all special characters with an underscore.
I have this:
snippet us "replace specials with underscores" w
${1:${VISUAL}}
`!p
import re
snip.rv = re.sub("[^0-9a-zA-Z]", "_", t[1])
`
endsnippet
Now something like Hello world!
becomes:
Hello world!
Hello_World_
However, at the end, I would like to keep only the second line and discard what I typed initially. Is that possible? Maybe using post_expand
?