100 lines
1.7 KiB
Plaintext
100 lines
1.7 KiB
Plaintext
global !p
|
|
from ultisnips.all import *
|
|
from ultisnips.c import *
|
|
endglobal
|
|
|
|
|
|
snippet fun "C function" b
|
|
${1:int} ${2:main}(${3:void})
|
|
{
|
|
${0}
|
|
return `!p snip.rv = returnval(t[1], t[2])`;
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
snippet note "Add a note (TODO, FIXME or XXX)" b
|
|
/* ${1}`!p
|
|
snip.rv =getNoteCandidates(t[1])
|
|
`(`!p
|
|
snip.rv = getUsername("valeth", True)
|
|
` @ `!v
|
|
strftime("%d.%m.%y")
|
|
`): ${2:DESCRIPTION} */
|
|
endsnippet
|
|
|
|
|
|
snippet doxfun "Doxygen function documentation" b
|
|
/**
|
|
* ${1:DESCRIPTION}
|
|
* @brief ${2:BRIEF}
|
|
* @param ${3:PARAM}
|
|
* @return ${4:RETURN}
|
|
*/
|
|
endsnippet
|
|
|
|
|
|
snippet doxhead "Doxygen documentation file header" b
|
|
/**
|
|
* @author ${1:`!p snip.rv = getUsername("valeth", True)`}
|
|
* @date ${2:`!v strftime("%d.%m.%Y")`}
|
|
* @file ${3:`!v expand("%:t")`}
|
|
*/
|
|
|
|
endsnippet
|
|
|
|
|
|
snippet malloc "Allocate memory on the heap"
|
|
${1:TYPE} ${2:NAME} = ($1)malloc(sizeof(*$2));
|
|
endsnippet
|
|
|
|
|
|
snippet calloc "Allocate memory on the heap"
|
|
${1:TYPE} ${2:NAME} = ($1)calloc(${3:N}, sizeof(*$2));
|
|
endsnippet
|
|
|
|
|
|
snippet incl "Default includes"
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
endsnippet
|
|
|
|
|
|
snippet for "For loop"
|
|
for (${1:INITIALIZER}; ${2:TEST}; ${3:INCREMENTER}) \{
|
|
${4:#error "incomplete for loop"}
|
|
\}
|
|
endsnippet
|
|
|
|
|
|
snippet while "While loop"
|
|
while (${1:TEST}) \{
|
|
${2:#error "incomplete while loop"}
|
|
\}
|
|
endsnippet
|
|
|
|
|
|
snippet if "If-Then control construct"
|
|
if (${1:TEST}) \{
|
|
${2:#error "incomplete if branch"}
|
|
\}
|
|
endsnippet
|
|
|
|
|
|
snippet ite "If-Then-Else control construct"
|
|
if (${1:TEST}) \{
|
|
${2:#error "incomplete if branch"}
|
|
\} else \{
|
|
${3:#error "incomplete else branch"}
|
|
\}
|
|
endsnippet
|
|
|
|
|
|
snippet elif "Else-If control construct"
|
|
else if (${1:TEST}) \{
|
|
${2:#error "incomplete elif branch"}
|
|
\}
|
|
endsnippet
|
|
|