bsnip("if", "if ...:<CR>", r""" if $1: $0 """) bsnip("else", "else:<CR>", r""" else: $0 """, aliases=["el"]) bsnip("elif", "elif ...:<CR>", r""" elif $1: $0 """, aliases = ["ei"]) babbr("im", "import ") babbr("from", "from ${1:module} import $0") bsnip("ifmain", "if __name__ == '__main__':...", r""" if __name__ == '__main__': ${1:main()} """) ## @todo Include arguments in docstring. bsnip("def", "def func(...):...", r''' def ${1:funcName}($2): """${3:Description of function $1}`!p snip.rv = autoPeriod(t[3])`""" ${4:pass} ''', aliases=["func"]) # @todo Consider other __xxx__ words for popup menu, or perhaps
typedef struct ${1:name} { $0 } $1; """) # Pre-processor. bsnip("inc", r"""#include 'Header.h'""", r""" #include "${1:`!p res=re.sub(r'\.[^.]+$', '', fn)+'.h'`}" """) bsnip("Inc", "#include <Header.h>", r""" #include <${1:.h}> """) # Doxygen. babbr("@param", "@param[in] ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi"]) babbr("@po", "@param[out] ${1:outParam} ${0:@todo Description of $1.}") babbr("@pio", "@param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}") babbr("@b", "@brief ${0:Description.}") babbr("@return", "@return ", aliases=["@re", "@ret"]) bsnip("@retval", "@retval value, Description", r""" @retval ${1:returnValue} ${0:Reason to return $1.} """, aliases=["@rv"]) babbr("/**", "/** @brief ${1:Brief description with period.} */") babbr("todo", "/** @todo ${1:Description of what's TO DO.} */") babbr("bug", "/** @bug ${1:Description of BUG.} */")
# Standard data types. # int8_t, uint8_t, and friends. for width in [8, 16, 32, 64]: t = "%d" % width t_t = t + "_t" wabbr("i" + t, "int" + t_t) wabbr("ui" + t, "uint" + t_t, aliases=[t]) wabbr("st", "size_t") wabbr("sst", "ssize_t") wabbr("un", "unsigned") # Doxygen. babbr("@param", "@param[in] ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi"]) babbr("@po", "@param[out] ${1:outParam} ${0:@todo Description of $1.}") babbr("@pio", "@param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}") babbr("@b", "@brief ${0:Description.}") babbr("@return", "@return ", aliases=["@re", "@ret"]) bsnip("@retval", "@retval value, Description", r""" @retval ${1:returnValue} ${0:Reason to return $1.} """, aliases=["@rv"]) babbr("/**", "/** @brief ${1:Brief description}" + "`!p snip.rv = autoPeriod(t[1])` */") babbr("todo", "/** @todo ${1:Description of what's TO DO}" + "`!p snip.rv = autoPeriod(t[1])` */") babbr("bug", "/** @bug ${1:Description of BUG}" + "`!p snip.rv = autoPeriod(t[1])` */")
# Standard data types. # int8_t, uint8_t, and friends. for width in [8, 16, 32, 64]: t = "%d" % width t_t = t + "_t" wabbr("i" + t, "int" + t_t) wabbr("ui" + t, "uint" + t_t, aliases=[t]) wabbr("st", "size_t") wabbr("sst", "ssize_t") wabbr("un", "unsigned") wabbr("uc", "unsigned char") # Doxygen. babbr("@param", "@param[in] ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi"]) babbr("@po", "@param[out] ${1:outParam} ${0:@todo Description of $1.}") babbr("@pio", "@param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}") babbr("@b", "@brief ${0:Description.}") babbr("@return", "@return ", aliases=["@re", "@ret"]) bsnip("@retval", "@retval value, Description", r""" @retval ${1:returnValue} ${0:Reason to return $1.} """, aliases=["@rv"]) babbr("/**", "/** @brief ${1:Brief description}" + "`!p snip.rv = autoPeriod(t[1])` */") babbr("todo", "/** @todo ${1:Description of what's TO DO}" + "`!p snip.rv = autoPeriod(t[1])` */") babbr("bug", "/** @bug ${1:Description of BUG}" + "`!p snip.rv = autoPeriod(t[1])` */")
$0 } $1; """) # Pre-processor. bsnip("inc", r"""#include 'Header.h'""", r""" #include "${1:`!p res=re.sub(r'\.[^.]+$', '', fn)+'.h'`}" """) bsnip("Inc", "#include <Header.h>", r""" #include <${1:.h}> """) # Doxygen. babbr("@param", "@param[in] ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi"]) babbr("@po", "@param[out] ${1:outParam} ${0:@todo Description of $1.}") babbr("@pio", "@param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}") babbr("@b", "@brief ${0:Description.}") babbr("@return", "@return ", aliases=["@re", "@ret"]) bsnip("@retval", "@retval value, Description", r""" @retval ${1:returnValue} ${0:Reason to return $1.} """, aliases=["@rv"]) babbr("/**", "/** @brief ${1:Brief description with period.} */") babbr("todo", "/** @todo ${1:Description of what's TO DO.} */") babbr("bug", "/** @bug ${1:Description of BUG.} */")
bsnip("if", "if ...:<CR>", r""" if $1: $0 """) bsnip("else", "else:<CR>", r""" else: $0 """, aliases=["el"]) bsnip("elif", "elif ...:<CR>", r""" elif $1: $0 """, aliases = ["ei"]) babbr("im", "import ") babbr("from", "from ${1:module} import $0") bsnip("ifmain", "if __name__ == '__main__':...", r""" if __name__ == '__main__': ${1:main()} """) ## @todo Include arguments in docstring. bsnip("def", "def func(...):...", r''' def ${1:funcName}($2): """${3:Description of function $1.}""" ${4:pass} ''', aliases=["func"]) # @todo Consider other __xxx__ words for popup menu, or perhaps
@param[in] argc Number of arguments in @c argv. @param[in] argv Command-line arguments. @returns 0 on success, nonzero on failure. */ int main(int argc, const char *argv[]) { $0 return 0; } """, flags="b!") babbr("todo", "/* ### ${1:Description of what's TO DO.} */", flags="b!") babbr("bug", "/* ### ${1:Description of BUG.} */", flags="b!") babbr("@param", r""" @param[in] ${1:inParam} ${0:@todo Description of $1.} """, flags="b!", aliases=["@p", "@pi"]) babbr("@po", r""" @param[out] ${1:outParam} ${0:@todo Description of $1.} """, flags="b!") babbr("@pio",r""" @param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}
Number of arguments in @c argv. @param[in] argv Command-line arguments. @returns 0 on success, nonzero on failure. */ int main(int argc, const char *argv[]) { $0 return 0; } """, flags="b!") babbr("todo", "/* ### ${1:Description of what's TO DO.} */", flags="b!") babbr("bug", "/* ### ${1:Description of BUG.} */", flags="b!") babbr("@param", r""" @param[in] ${1:inParam} ${0:@todo Description of $1.} """, flags="b!", aliases=["@p", "@pi"]) babbr("@po", r""" @param[out] ${1:outParam} ${0:@todo Description of $1.} """,