Update UltiSnips snippets

This commit is contained in:
foo-dogsquared 2019-12-20 10:44:54 +08:00
parent 083b2c666f
commit b818e30a2f
3 changed files with 76 additions and 4 deletions

View File

@ -29,3 +29,37 @@ ${2:Gabriel Arazas}
$0
endsnippet
snippet ie "Parenthetical material Latin 'id est' (ie)" iw
(i.e., $1) $0
endsnippet
snippet eg "Parenthetical material Latin 'exempli gratia' (eg)" iw
(e.g., $1) $0
endsnippet
snippet em "Quick em dash"
endsnippet
snippet em-mat "Em dash material" iw
— $1 — $0
endsnippet
snippet em-ie "'id est' surrounded with em dash" iw
— i.e., $1 — $0
endsnippet
snippet em-eg "'exempli gratia' surrounded with em dash" iw
— e.g., $1 — $0
endsnippet
# Quick word snippets
# Each of these quick word snippets has a prefix of `qw-`
snippet qw-lx "LaTeX" iw
LaTeX
endsnippet
snippet qw-as "Asciidoctor" iw
Asciidoctor
endsnippet

View File

@ -12,16 +12,32 @@ def smart_space(next_str, auto_str=" ", loose=False):
endglobal
# Text formatting
snippet "h(\d)" "Quick header snippet" biw
snippet "h(\d)" "Quick header snippet" bir
`!p
header_level = int(match.group(1))
legit_header_level = True if header_level >= 1 and header_level <= 6 else False
snip.rv = "#" * header_level if legit_header_level else ""
snip.rv = "=" * header_level if legit_header_level else ""
`
$0
endsnippet
snippet ch "Chapter header" bi
== $1
$0
endsnippet
snippet "sh(\d)" "Section header" bir
`!p snip.rv = "=" * int(match.group(1))`
endsnippet
snippet bf "Boldface" iw
**$1** $0
endsnippet
@ -79,7 +95,7 @@ $0
endsnippet
snippet src "Source code listings" bi
[source,${1:<language>}]
[source, ${1:<language>}]
----
${2:<source code>}
----
@ -171,3 +187,25 @@ snippet abstract "Abstract block" bi
$0
endsnippet
snippet append "Appendix block" bi
[appendix]
== ${1:Appendix}
$0
endsnippet
snippet stem "Stem block" bi
[stem]
++++
$1
++++
$0
endsnippet
snippet mstem "Stem macro" iw
stem:[$1] $0
endsnippet
snippet foot "Footnote macro" iw
footnote:[$1] $0
endsnippet

View File

@ -1,5 +1,5 @@
snippet usnip "A working snippet for creating UltiSnips snippets" ib
`!p snip.rv = "snippet"` ${1:<word_trigger>} ${2:<description>} ${3:<flags>}
`!p snip.rv = "snippet"` ${1:<word_trigger>} "${2:<description>}" ${3:<flags>}
$4
`!p snip.rv = "endsnippet"`
$0