From 0fa8a6c3815bb089bc24d24e51ab8a0e9a57650c Mon Sep 17 00:00:00 2001 From: zeayes Date: Sat, 2 Aug 2014 15:50:28 +0800 Subject: [PATCH 1/4] add some snippets, use TAB to continue edit and change the code style. --- UltiSnips/c.snippets | 67 +++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index e6ea2f9d2..ed464e7ca 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -4,6 +4,16 @@ priority -50 +snippet bcomment "block comment" +/* + * ${1} + */ +endsnippet + +snippet lcomment "line comment" +/* $1 */ +endsnippet + snippet def "#define ..." #define ${1} endsnippet @@ -38,24 +48,28 @@ $0 endsnippet snippet main "main() (main)" -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { ${VISUAL}${0} + return 0; } endsnippet snippet for "for loop (for)" -for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) -{ - ${VISUAL}${0} +for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { + ${VISUAL}${4} +} +endsnippet + +snippet forp "for pointer loop (for)" +for (${1:p} = ${2}; $1 != NULL; $1 = $2->${3}) { + ${VISUAL}${4} } endsnippet snippet fori "for int loop (fori)" -for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) -{ - ${VISUAL}${0} +for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { + ${VISUAL}${4} } endsnippet @@ -86,14 +100,14 @@ endsnippet snippet wh "while loop" while(${1:/* condition */}) { - ${VISUAL}${0} + ${VISUAL}${2} } endsnippet snippet do "do...while loop (do)" do { - ${VISUAL}${0} -} while(${1:/* condition */}); + ${VISUAL}${1} +} while(${2:/* condition */}); endsnippet snippet fprintf "fprintf ..." @@ -101,31 +115,28 @@ fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|% endsnippet snippet if "if .. (if)" -if (${1:/* condition */}) -{ - ${VISUAL}${0} +if (${1:/* condition */}) { + ${VISUAL}${2} } endsnippet snippet el "else .. (else)" else { - ${VISUAL}${0} + ${VISUAL}${1} } endsnippet snippet eli "else if .. (eli)" else if (${1:/* condition */}) { - ${VISUAL}${0} + ${VISUAL}${2} } endsnippet snippet ife "if .. else (ife)" -if (${1:/* condition */}) -{ +if (${1:/* condition */}) { ${2} } -else -{ +else { ${3:/* else */} } endsnippet @@ -135,16 +146,20 @@ printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2 endsnippet snippet st "struct" -struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} -{ - ${0:/* data */} +struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} { + ${2:/* data */} }; endsnippet +snippet std "struct" +typedef struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} { + ${2:/* data */} +}${3}; +endsnippet + snippet fun "function" b -${1:void} ${2:function_name}(${3}) -{ - ${VISUAL}${0} +${1:void} ${2:function_name}(${3}) { + ${VISUAL}${4} } endsnippet From 6a682e61b1b7f6dbe12d2405511b81b4287f3810 Mon Sep 17 00:00:00 2001 From: zeayes Date: Sat, 2 Aug 2014 16:00:22 +0800 Subject: [PATCH 2/4] update c.snippet --- UltiSnips/c.snippets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index ed464e7ca..a97ece21a 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -31,11 +31,11 @@ ${VISUAL}${0} endsnippet snippet inc "#include local header (inc)" -#include "${1:`!p snip.rv = snip.basename + '.h'`}" +#include "${1:`!p snip.rv = snip.basename + '.h'`}"${2} endsnippet snippet Inc "#include <> (Inc)" -#include <${1:.h}> +#include <${1:.h}>${2} endsnippet snippet mark "#pragma mark (mark)" @@ -62,7 +62,7 @@ for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { endsnippet snippet forp "for pointer loop (for)" -for (${1:p} = ${2}; $1 != NULL; $1 = $2->${3}) { +for (${1:p} = ${2}; $1 != NULL; $1 = $1->${3}) { ${VISUAL}${4} } endsnippet From a7cdef087634b8ba4ad0a223c61f889436e06684 Mon Sep 17 00:00:00 2001 From: zeayes Date: Wed, 26 Nov 2014 17:33:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E3=80=90add=E3=80=91add=20html5=20viewport?= =?UTF-8?q?=20snippet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/html.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/html.snippets b/snippets/html.snippets index 3642bbca7..2f74e53d0 100644 --- a/snippets/html.snippets +++ b/snippets/html.snippets @@ -836,3 +836,5 @@ snippet video