########################################################################### # General Stuff # ########################################################################### snippet part "Part" b `!p snip.rv = len(t[1])*'#'` ${1:Part name} `!p snip.rv = len(t[1])*'#'` $0 endsnippet snippet sec "Section" b ${1:Section name} `!p snip.rv = len(t[1])*'='` $0 endsnippet snippet ssec "Subsection" b ${1:Section name} `!p snip.rv = len(t[1])*'-'` $0 endsnippet snippet sssec "Subsubsection" b ${1:Section name} `!p snip.rv = len(t[1])*'^'` $0 endsnippet snippet chap "Chapter" b `!p snip.rv = len(t[1])*'*'` ${1:Chapter name} `!p snip.rv = len(t[1])*'*'` $0 endsnippet snippet para "Paragraph" b ${1:Paragraph name} `!p snip.rv = len(t[1])*'"'` $0 endsnippet snippet em "Emphasize string" i *${1:Em}* $0 endsnippet snippet ec "Emphasize string (CJK)" w \ *${1:Em}*\ $0 endsnippet snippet st "Strong string" i **${1:Strong}** $0 endsnippet snippet sc "Strong string (CJK)" w \ **${1:Strong}**\ $0 endsnippet global !p def make_items(times, leading='+'): times = int(times) if leading == 1: msg = "" for x in xrange(1, times+1): msg += "%s. Item\n" % x return msg else: return ("%s Item\n" % leading) * times endglobal snippet "li(st)? (?P\d+)" "List" br $0 `!p snip.rv = make_items(match.groupdict()['num']) ` endsnippet snippet "ol(st)? (?P\d+)" "Order List" br $0 `!p snip.rv = make_items(match.groupdict()['num'], 1) ` endsnippet ########################################################################### # More Specialized Stuff. # ########################################################################### snippet cb "Code Block" b .. code-block:: ${1:lua} ${2:code} $0 endsnippet snippet img "Image Block" b .. |${2:alias}| image:: ${1:img} endsnippet snippet fig "Figure Block" b .. figure:: ${1:img} :alt: ${2:alter text} ${3} $0 endsnippet snippet cont "Content Block" b .. contents:: ${1:Contents Title} $0 endsnippet snippet tip "Tip Block" b .. tip:: ${1:some tips} $0 endsnippet snippet not "Note Block" b .. note:: ${1:some notes} $0 endsnippet snippet war "Warning Block" b .. warning:: ${1:Warning!} $0 endsnippet snippet imp "Important Block" b .. important:: ${1:This is important} $0 endsnippet snippet att "Attention " b .. attention:: ${1:Attention!} $0 endsnippet snippet dan "Danger" b .. danger:: ${1:Danger} $0 endsnippet snippet err "Error Block" b .. error:: ${1:Errors!} $0 endsnippet snippet cau "Cautions Block" b .. caution:: ${1:Cautions!} $0 endsnippet snippet top "Topic" b .. topic:: ${1:title} ${2:contents} $0 endsnippet ############ # Sphinx # ############ snippet sid "SideBar" b .. sidebar:: ${1:SideBar Title} ${2:SideBar Content} endsnippet # vim:ft=snippets: