From 9ced2a2f6b78b3b4d708731f870cf655269a081b Mon Sep 17 00:00:00 2001 From: REmerald <55359236+REmerald@users.noreply.github.com> Date: Tue, 21 Nov 2023 00:45:50 +0300 Subject: [PATCH 1/3] (c.json) improve function snips Make former `fund` (-> `fun`) more universal Also, make the prefixes more logical --- snippets/c/c.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/snippets/c/c.json b/snippets/c/c.json index 92d8b1af..59519664 100644 --- a/snippets/c/c.json +++ b/snippets/c/c.json @@ -214,13 +214,13 @@ "body": ["for (int ${1:i} = ${2:1}; $1 < argc; $1++) {$0", "}"], "description": "'for' loop for cmdline arguments" }, - "Function declaration": { - "prefix": "fund", - "body": ["${2:void} ${1:fun}(${3:void});"], - "description": "Declare a function" + "Function ...": { + "prefix": "fun", + "body": ["${2:void} ${1:fun}(${3:void})$0"], + "description": "Make a function declaration/definition/pointer" }, "Function definition": { - "prefix": "fun", + "prefix": "func", "body": ["${2:void} ${1:fun}(${3:void})", "{$0", "}"], "description": "Define a function" }, From 235182800075ca78a1f8153a229e9eda9518ca1e Mon Sep 17 00:00:00 2001 From: REmerald <55359236+REmerald@users.noreply.github.com> Date: Tue, 21 Nov 2023 19:59:33 +0300 Subject: [PATCH 2/3] (c.json) Add _GNU_SOURCE snippet Snippet to enable GNU functions --- snippets/c/c.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/c/c.json b/snippets/c/c.json index 59519664..a2f84513 100644 --- a/snippets/c/c.json +++ b/snippets/c/c.json @@ -73,6 +73,11 @@ "body": ["#define ${1:MACRO}($2) ($3)"], "description": "Function-like macro snippet" }, + "_GNU_SOURCE": { + "prefix": "#gnu", + "body": ["#define _GNU_SOURCE"], + "description": "Enable GNU extensions" + }, "#if": { "prefix": "#if", "body": ["#if ${1:0}", "$0", "#endif /* if $1 */"], From e83ce9018f3375acbd4b9d6b6f6685406344bc51 Mon Sep 17 00:00:00 2001 From: REmerald <55359236+REmerald@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:04:34 +0000 Subject: [PATCH 3/3] (c.json) Update GNU_SOURCE description Update the description to be more specific for newbies to C --- snippets/c/c.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/c/c.json b/snippets/c/c.json index a2f84513..580181d8 100644 --- a/snippets/c/c.json +++ b/snippets/c/c.json @@ -76,7 +76,7 @@ "_GNU_SOURCE": { "prefix": "#gnu", "body": ["#define _GNU_SOURCE"], - "description": "Enable GNU extensions" + "description": "Enable GNU extensions (functions)" }, "#if": { "prefix": "#if",