diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index 3dcd0e8..2e00a39 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -53,7 +53,7 @@ params = t[3].replace(", ", ",").split(",") rval = "" for param in params: if len(param.split(' ')) >= 2: - rval += f"\n *\t@param {param}:\t{t[2]}_{param.split(' ')[1]}" + rval += f"\n *\t@param {param}" snip.rv = rval` */ ${1:int} ${2:MyFunc} (${3:void}); @@ -69,7 +69,7 @@ params = t[3].replace(", ", ",").split(",") rval = "" for param in params: if len(param.split(' ')) >= 2: - rval += f"\n *\t@param {param}:\t{t[2]}_{param.split(' ')[1]}" + rval += f"\n *\t@param {param}" snip.rv = rval` */ ${1:int} ${2:MyFunc} (${3:void}) { @@ -97,7 +97,7 @@ endsnippet snippet "(\w+) = malloc" "Automativ malloc error implementation" rA /* Allocate memory for `!p snip.rv = match.group(1)` */ -`!p snip.rv = match.group(1)` = malloc(sizeof(${1:int}) * $2); +`!p snip.rv = match.group(1)` = ($1*)malloc(sizeof(${1:int}) * $2); if (!`!p snip.rv = match.group(1)`) { /* Error */ perror("malloc error on memory allocation of: `!p snip.rv = match.group(1)`"); diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets index b4aa871..cedddd0 100644 --- a/UltiSnips/cpp.snippets +++ b/UltiSnips/cpp.snippets @@ -16,17 +16,16 @@ endsnippet snippet exfun "New Function with Documentation" /** - * $2 -> $1 + * @name $2 * @return $1 - * @brief Description: - * ${4: Description} + * @brief ${4: Description} * - @param `!p + `!p params = t[3].split(", ") rval = "" for param in params: if len(param.split(' ')) == 2: - rval += f" * {param}:\t{t[2]}_{param.split(' ')[1]}\n" + rval += f" * @param {param}:\t{t[2]}_{param.split(' ')[1]}\n" snip.rv = rval` */ ${1:int} ${2:MyFunc} (${3:void}) { @@ -182,16 +181,15 @@ endsnippet snippet pfun "prototype for function" bA /** - * $2 -> $1 + * @name $2 * @return $1 - * @brief Description: - * ${4: Description} - * @param Parameter:`!p + * @brief ${4: Description} + * `!p params = t[3].split(", ") rval = "" for param in params: if len(param.split(' ')) >= 2: - rval += f"\n *\t\t{param}:\t{t[2]}_{param.split(' ')[1]}" + rval += f"\n *\t@param {param}:\t{t[2]}_{param.split(' ')[1]}" snip.rv = rval` */ ${1:int} ${2:MyFunc} (${3:void});