From 7be6694232ca3ea9a496b7cc847d9d524f4042e1 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Wed, 20 Feb 2013 09:45:37 +0100 Subject: [PATCH] Improvements to c.snippets by melko. --- UltiSnips/c.snippets | 23 +++++++++++++++++++++-- doc/UltiSnips.txt | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index 8831f4f..1705115 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -43,8 +43,15 @@ int main(int argc, char const *argv[]) } endsnippet -snippet for "for int loop (fori)" -for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +snippet for "for loop (for)" +for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} +} +endsnippet + +snippet fori "for int loop (fori)" +for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} } @@ -75,6 +82,12 @@ snippet td "Typedef" typedef ${1:int} ${2:MyCustomType}; endsnippet +snippet wh "while loop" +while(${1:/* condition */}) { + ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} +} +endsnippet + snippet do "do...while loop (do)" do { ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} @@ -92,6 +105,12 @@ if (${1:/* condition */}) } endsnippet +snippet el "else .. (else)" +else { + ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}} +} +endsnippet + snippet ife "if .. else (ife)" if (${1:/* condition */}) { diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index 6f0deed..6273a6b 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -1334,6 +1334,7 @@ Contributors listed in chronological order: David Brown (Nali4Freedom) Harry Xu (harryxu) Tom Cammann (takac) + melko Thank you for your support.