Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global !p
- def VinLudens():
- import re
- CurrentLine = snip.buffer[snip.line]
- Pattern = re.compile("[^:,]+")
- LiteralSnippet = ""
- Index = 1
- snip.buffer[snip.line] = ""
- for j in Pattern.findall(CurrentLine):
- LiteralSnippet += (j + " = $" + str(Index) + "\n")
- Index += 1
- snip.expand_anon(LiteralSnippet)
- endglobal
- # |TODO|: Find out how to make the first placeholder to set the cursor in its
- # correct position (it appears one character behind its correct position
- pre_expand "VinLudens()"
- snippet "^:.+:$" "" rA
- endsnippet
- # SNAP
- # ===============================
- # -> :1,2:<tab>
- # a =$1
- # b = $2
- # ===============================
- # -> :1,2,3,4,5:<tab>
- # 1 =$1
- # 2 = $2
- # 3 = $3
- # 4 = $4
- # 5 = $5
- # ===============================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement