From 73f22df5ca68739da372c3f0c89bab53205204fe Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sun, 26 Apr 2015 19:44:26 +0100 Subject: [PATCH] C: Remove some duplication --- UltiSnips/c.snippets | 20 -------------------- snippets/c.snippets | 16 +++++++++++----- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index c621a36..5c4299c 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -97,32 +97,12 @@ snippet fprintf "fprintf ..." fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/} endsnippet -snippet if "if .. (if)" -if (${1:/* condition */}) { - ${VISUAL}${0} -} -endsnippet - -snippet el "else .. (else)" -else { - ${VISUAL}${0} -} -endsnippet - snippet eli "else if .. (eli)" else if (${1:/* condition */}) { ${VISUAL}${0} } endsnippet -snippet ife "if .. else (ife)" -if (${1:/* condition */}) { - ${2} -} else { - ${3:/* else */} -} -endsnippet - snippet printf "printf .. (printf)" printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/} endsnippet diff --git a/snippets/c.snippets b/snippets/c.snippets index 96e19a0..aa7ce84 100644 --- a/snippets/c.snippets +++ b/snippets/c.snippets @@ -52,22 +52,28 @@ snippet once ## Control Statements # if snippet if - if (${1:/* condition */}) { + if (${1:true}) { + ${0} + } +snippet ife + if (${1:true}) { ${2} + } else { + ${0} } # else snippet el else { - ${1} + ${0} } # else if snippet elif - else if (${1:/* condition */}) { - ${2} + else if (${1:true}) { + ${0} } # ifi snippet ifi - if (${1:/* condition */}) ${2}; + if (${1:true}) ${0}; # ternary snippet t ${1:/* condition */} ? ${2:a} : ${3:b}