From 1d61b86ab7e925e50f5b340d65eafbb082081561 Mon Sep 17 00:00:00 2001 From: Erich Heine Date: Wed, 23 Sep 2015 13:58:12 -0500 Subject: [PATCH] Enhance python `with` snippet for UltiSnips * the `with` snippet in UltiSnips now contains a VISUAL element * The `as` keyword portion of a with statement now uses python interpolation to determine presence --- UltiSnips/python.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets index a5ef2aa..6dfa3c9 100644 --- a/UltiSnips/python.snippets +++ b/UltiSnips/python.snippets @@ -16,6 +16,12 @@ if __name__ == `!p snip.rv = get_quoting_style(snip)`__main__`!p snip.rv = get_q ${1:${VISUAL:main()}} endsnippet +snippet with "with" b +with ${1:expr}`!p snip.rv = " as " if t[2] else ""`${2:var}: + ${3:${VISUAL:pass}} +${0} +endsnippet + snippet for "for loop" b for ${1:item} in ${2:iterable}: ${3:${VISUAL:pass}}