Major changes including better ui and more keybinds :)

This commit is contained in:
2023-02-15 23:11:33 -05:00
parent 52ba49ec82
commit 8c8512386b
24 changed files with 664 additions and 118 deletions

29
lua/core/snippets/c.lua Normal file
View File

@ -0,0 +1,29 @@
ls.add_snippets('c', {
s('trip', {
-- cond ? then : else statment
i(1, 'cond'), t(' ? '), i(2, 'then'), t(' : '), i(3, 'else')
}),
s('stdlibs', {
-- cond ? then : else statment
t('#include <stdio.h>'),
t({'', '#include <stdlib.h>'})
}),
s('die', {
t({
'void die(const char *fmt, ...) {', '',
'va_list ap;',
'',
'va_start(ap, fmt);',
'vfprintf(stderr, fmt, ap);',
'va_end(ap);',
'',
[[if (fmt[0] && fmt[strlen(fmt)-1] == ':') {]],
[[ fputc(' ', stderr);]],
' perror(NULL);',
'} else',
[[ fputc('\n', stderr);]],
' exit(1);',
'}',
})
})
})