aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/ansi_c/init.lua54
-rw-r--r--modules/lua/init.lua24
2 files changed, 37 insertions, 41 deletions
diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua
index c4296023..e4be3710 100644
--- a/modules/ansi_c/init.lua
+++ b/modules/ansi_c/init.lua
@@ -99,37 +99,35 @@ keys.ansi_c = {}
-- Snippets.
-if type(snippets) == 'table' then
---
-- Table of C-specific snippets.
-- @class table
-- @name _G.snippets.ansi_c
- snippets.ansi_c = {
- func = '%1(int) %2(name)(%3(args)) {\n\t%0\n\treturn %4(0);\n}',
- vfunc = 'void %1(name)(%2(args)) {\n\t%0\n}',
- ['if'] = 'if (%1) {\n\t%0\n}',
- eif = 'else if (%1) {\n\t%0\n}',
- ['else'] = 'else {\n\t%0\n}',
- ['for'] = 'for (%1; %2; %3) {\n\t%0\n}',
- ['fori'] = 'for (%1(int) %2(i) = %3(0); %2 %4(<) %5(count); %2%6(++)) {\n'..
- '\t%0\n}',
- ['while'] = 'while (%1) {\n\t%0\n}',
- ['do'] = 'do {\n\t%0\n} while (%1);',
- sw = 'switch (%1) {\n\tcase %2:\n\t\t%0\n\t\tbreak;\n}',
- case = 'case %1:\n\t%0\n\tbreak;',
-
- st = 'struct %1(name) {\n\t%0\n};',
- td = 'typedef %1(int) %2(name_t);',
- tds = 'typedef struct %1(name) {\n\t%0\n} %1%2(_t);',
-
- def = '#define %1(name) %2(value)',
- inc = '#include "%1"',
- Inc = '#include <%1>',
- pif = '#if %1\n%0\n#endif',
-
- main = 'int main(int argc, const char **argv) {\n\t%0\n\treturn 0;\n}',
- printf = 'printf("%1(%s)\\n", %2);',
- }
-end
+snippets.ansi_c = {
+ func = '%1(int) %2(name)(%3(args)) {\n\t%0\n\treturn %4(0);\n}',
+ vfunc = 'void %1(name)(%2(args)) {\n\t%0\n}',
+ ['if'] = 'if (%1) {\n\t%0\n}',
+ eif = 'else if (%1) {\n\t%0\n}',
+ ['else'] = 'else {\n\t%0\n}',
+ ['for'] = 'for (%1; %2; %3) {\n\t%0\n}',
+ ['fori'] = 'for (%1(int) %2(i) = %3(0); %2 %4(<) %5(count); %2%6(++)) {\n'..
+ '\t%0\n}',
+ ['while'] = 'while (%1) {\n\t%0\n}',
+ ['do'] = 'do {\n\t%0\n} while (%1);',
+ sw = 'switch (%1) {\n\tcase %2:\n\t\t%0\n\t\tbreak;\n}',
+ case = 'case %1:\n\t%0\n\tbreak;',
+
+ st = 'struct %1(name) {\n\t%0\n};',
+ td = 'typedef %1(int) %2(name_t);',
+ tds = 'typedef struct %1(name) {\n\t%0\n} %1%2(_t);',
+
+ def = '#define %1(name) %2(value)',
+ inc = '#include "%1"',
+ Inc = '#include <%1>',
+ pif = '#if %1\n%0\n#endif',
+
+ main = 'int main(int argc, const char **argv) {\n\t%0\n\treturn 0;\n}',
+ printf = 'printf("%1(%s)\\n", %2);',
+}
return M
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index a82d9884..b9cf16bf 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -116,22 +116,20 @@ keys.lua = {}
-- Snippets.
-if type(snippets) == 'table' then
---
-- Container for Lua-specific snippets.
-- @class table
-- @name _G.snippets.lua
- snippets.lua = {
- func = 'function %1(name)(%2(args))\n\t%0\nend',
- ['if'] = 'if %1 then\n\t%0\nend',
- eif = 'elseif %1 then\n\t',
- ['for'] = 'for %1(i) = %2(1), %3(10)%4(, %5(-1)) do\n\t%0\nend',
- forp = 'for %1(k), %2(v) in pairs(%3(t)) do\n\t%0\nend',
- fori = 'for %1(i), %2(v) in ipairs(%3(t)) do\n\t%0\nend',
- ['while'] = 'while %1 do\n\t%0\nend',
- ['repeat'] = 'repeat\n\t%0\nuntil %1',
- ['do'] = 'do\n\t%0\nend',
- }
-end
+snippets.lua = {
+ func = 'function %1(name)(%2(args))\n\t%0\nend',
+ ['if'] = 'if %1 then\n\t%0\nend',
+ eif = 'elseif %1 then\n\t',
+ ['for'] = 'for %1(i) = %2(1), %3(10)%4(, %5(-1)) do\n\t%0\nend',
+ forp = 'for %1(k), %2(v) in pairs(%3(t)) do\n\t%0\nend',
+ fori = 'for %1(i), %2(v) in ipairs(%3(t)) do\n\t%0\nend',
+ ['while'] = 'while %1 do\n\t%0\nend',
+ ['repeat'] = 'repeat\n\t%0\nuntil %1',
+ ['do'] = 'do\n\t%0\nend',
+}
return M