dotfiles/nvim/own-snippets/asciidoc.snippets
foo-dogsquared e5222304a1 Create a custom manager and migrate to nvim
I've migrated to Neovim because of one thing... Luke Smith-senpai...

Ever since I've seen him typed 'nvim' in his recent videos, I was devastated. All of those hours that my little heart and soul poured into creating a 130-line vimrc to configure Vim to its absolute in the way I wanted to use was gone. All of those 7 days and a few minutes every now and then, are crushed.

It is truly a betrayal to see it use a modernized version of a relic of the past. I first thought, "How dare he?". I was not able to sleep well the following days. It was heart-wrenching.

Out of spite, I've tried to. I've nothing left and you know there is a saying 'a weeb with nothing got nothing to lose'. All it took was to rename certain files, reinstall the plugin manager and its plugins, a grand total of 5 minutes. My heart skipped a beat.

It was like being a birb with broken wings trying to fly and eventually didn't left off until its talon is in the ground. And the ground is Neovim. Now I love Neovim more than ever... Thank you Luke Smith Unaboomer-kun-senpai. It was truly a wonderful experience.
2020-03-29 20:23:44 +08:00

220 lines
3.3 KiB
Plaintext

global !p
# Smartly automate inserting of certain characters.
# Mainly used for smart space insertion.
def smart_space(next_str, auto_str=" ", loose=False):
next_word = ""
if next_str:
if loose == True:
next_word = auto_str
elif next_str[0] in [",", ".", "-", "!", "?", " "]:
next_word = auto_str
return next_word
endglobal
# Text formatting
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
if header_level == 2:
snip.rv = "\n" * 4
else:
snip.rv = "\n" * 2
snip.rv += "=" * header_level if legit_header_level else ""
` ${1:Chapter name}
$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
snippet it "Italic" iw
__$1__ $0
endsnippet
snippet tt "Monospace" iw
\`$1\` $0
endsnippet
snippet hl "Highlighted text" iw
#$1# $0
endsnippet
snippet a "Hyperlink" iw
${1:<url>}[${2:<text>}] $0
endsnippet
snippet sp "Superscript" iw
^$1^ $0
endsnippet
snippet sb "Subscript" iw
~$1~ $0
endsnippet
snippet dt "Definition term" bi
${1:<term>}::
${2:<definition>}
$0
endsnippet
snippet ul "Unordered list item" bi
* ${1:<list item>}
$0
endsnippet
snippet ol "Ordered list item" bi
. ${1:<list item>}
$0
endsnippet
snippet -ol "Reversed ordered list (use it only once in a list)" bi
[%reversed]
. ${1:<list item>}
endsnippet
snippet bquote "Blockquote" bi
----
$1
----
$0
endsnippet
snippet src "Source code listings" bi
[source`!p snip.rv=smart_space(t[1], ", ", loose=True)`${1:<language>}]
----
${2:<source code>}
----
$0
endsnippet
snippet "-table (\d+)-" "Make a quick table" bir
[cols="`!p snip.rv = match.group(1)`*"]
|===
$1
|===
$0
endsnippet
snippet "-table h (\d+)-" "Make a quick table with the headers already set up" bir
[cols="`!p snip.rv = match.group(1)`", options="headers"]
|===
$1
`!p
number_of_headers = int(match.group(1))
for i in range(0, number_of_headers):
snip.rv += f"| Header {i + 1}\n"
`
$2
|===
$0
endsnippet
# Multimedia blocks
snippet figure "Image block with caption" bi
.${2:<caption>}
image::${1:<image path>}[$2, ${3:width=100%,height=100%}]
$0
endsnippet
snippet -figure "Inline image" i
image:${1:<image path>}[${2}] $0
endsnippet
snippet video "Video block" bi
video::${1:<image path>}[$2]
$0
endsnippet
snippet youtube "YouTube video block" bi
video::${1:<YouTube video ID>}[youtube]
$0
endsnippet
snippet vimeo "Vimeo video block" bi
video::${1:<Vimeo video ID>}[vimeo]
$0
endsnippet
snippet audio "Audio block" bi
audio::${1:<image path>}[`!p snip.rv=smart_space(t[2], "options=", loose=True)`$2]
$0
endsnippet
# Other features
snippet incl "Include document" bi
include::${1:<file path>}[${2:<options>}]
$0
endsnippet
snippet oblock "Open block" bi
--
$1
--
$0
endsnippet
snippet sidebar "Sidebar as an open block" bi
[sidebar]
.${1:<title>}
--
$2
--
$0
endsnippet
snippet abstract "Abstract block" bi
[abstract]
== ${1:Summary}
$0
endsnippet
snippet append "Appendix block" bi
[appendix]
== ${1:Appendix}
$0
endsnippet
snippet stem "Stem block" bi
[stem]
++++
$1
++++
$0
endsnippet
snippet stem "Stem macro" iw
stem:[$1] $0
endsnippet
snippet foot "Footnote macro" iw
footnote:[$1] $0
endsnippet