diff options
author | Squibid <me@zacharyscheiman.com> | 2023-11-24 21:38:31 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2023-11-24 21:38:31 -0500 |
commit | f35b13d669867209427449840ff0930a732591dc (patch) | |
tree | 3acb658ec5d01f456c49a097d56f736cbfbbfc7d /lua/snippet | |
parent | ebf9d2d1c4682068f5116f7efc1568ce5adf4f1b (diff) | |
download | nvim-f35b13d669867209427449840ff0930a732591dc.tar.gz nvim-f35b13d669867209427449840ff0930a732591dc.tar.bz2 nvim-f35b13d669867209427449840ff0930a732591dc.zip |
more stuff too lazy to seperate
Diffstat (limited to '')
-rw-r--r-- | lua/snippet/c.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lua/snippet/c.lua b/lua/snippet/c.lua index 3c1e127..7ef2e51 100644 --- a/lua/snippet/c.lua +++ b/lua/snippet/c.lua @@ -54,4 +54,26 @@ ls.add_snippets('c', { } ) ), + s({ + name = 'Variadic function parser', + trig = 'infinite vars', + dscr = 'Parse an infinite number of arguments passed to a function', + }, + { + t({ + "/*", + " * NOTE: the function must have a int before the ... argument", + " * and you need to include <stdarg.h> for this to work", + " */", + "va_list ptr;", + "va_start(ptr, ", i(1, "n"), + ");", + "for (int i = 0; i < ", ri(1), + "; i++) {", + i(2), + "}", + "va_end(ptr);", + }), + } + ) }) |