neovim: remove Ultisnips snippets

I don't use them anymore and find Luasnippets enough. Right now I just
have to figure how to make use more of them.
This commit is contained in:
Gabriel Arazas 2023-07-02 17:20:02 +08:00
parent 6560899a70
commit f04a83fd83
10 changed files with 0 additions and 1826 deletions

View File

@ -1,105 +0,0 @@
global !p
from datetime import datetime, timedelta
def relative_date(days = 0):
time_difference = timedelta(days=int(days))
calculated_date = datetime.today() + time_difference
return calculated_date
endglobal
snippet "reldate (-?\d+)( .+)?" "Prints out the relative date in ISO format." ri
`!p
reldate = relative_date(match.group(1))
date_format = match.group(2).strip(" \"") if match.group(2) is not None else "%F"
snip.rv = reldate.strftime(date_format)
`
endsnippet
snippet today "Prints out today's date in ISO format" i
`!p
from datetime import datetime
snip.rv = datetime.today().strftime("%F")
`
endsnippet
# Quick formatting.
snippet sign "Quick signature" i
${1:Sincerely,}
${2:Gabriel Arazas}
$0
endsnippet
snippet retrieve "Quick retrieval date in informal format" i
(retrieved `!p snip.rv = datetime.today().strftime("%F")`)
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
# En dashes
snippet -- "En dash"
endsnippet
# Em dashes (I've these dedicated snippets for some reason).
snippet --- "Em dash"
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
# Miscellaneous snippets
snippet #! "Quick snippet for a shebang." bi
#!${1:/usr/bin/env} ${2:sh}
endsnippet
# This is only useful for decorative comment boxes and all of the jazz.
snippet "boxen (.*)" "Create a box of stuff" ir
`!p snip.rv = (match.group(1) * (len(t[1]) + 4)).strip()[0:(len(t[1]) + 4)]`
`!p snip.rv = match.group(1)[0]` $1 `!p snip.rv = match.group(1)[0]`
`!p snip.rv = (match.group(1) * (len(t[1]) + 4)).strip()[0:(len(t[1]) + 4)]`
endsnippet
# Also stolen from Gilles Castel's post at https://castel.dev/post/lecture-notes-1/.
snippet box "More box (that looks more like a box)."
`!p snip.rv = '┌' + '─' * (len(t[1]) + 2) + '┐'`
│ $1 │
`!p snip.rv = '└' + '─' * (len(t[1]) + 2) + '┘'`
endsnippet

View File

@ -1,234 +0,0 @@
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(([1-6]))" "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 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 link "Link for files" iw
link:${1:<url>}[${2:\`$1\`}]
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"`!p snip.rv=smart_space(t[1], ", ", loose=True)`$1]
|===
`!p
number_of_headers = int(match.group(1))
for i in range(0, number_of_headers):
snip += f"| Header {i + 1}"
`
$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 verbatim "Literal text 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
`!p snip.rv = "\n" * 4`
[appendix]
== ${1:Additional readings}
$0
endsnippet
snippet bibres "Bibliographical resource in a definition block" bi
${1:<link>}[${2:<title>}] (retrieved ${3:date})::
${4:<description>}
endsnippet
snippet sidebar "Sidebar block" bi
${1:.<optional title>}
****
$2
****
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
snippet qn "Question and answer" iw
[qanda]
${1:QUESTION}::
${2:ANSWER}
endsnippet

View File

@ -1,4 +0,0 @@
snippet func "Function"
λ(${1:$PARAM : $TYPE}) → ${2:OUTPUT} $0
endsnippet

View File

@ -1,22 +0,0 @@
# Text formatting
snippet bf "Boldface" iw
**$1**
endsnippet
snippet tt "Teletype (or monospace text)" iw
\`$1\`
endsnippet
# Content formatting
snippet src "Source code listing" bi
```$1
$2
```
$0
endsnippet
snippet link "Quick link" i
[$1]($2)
endsnippet

View File

@ -1,56 +0,0 @@
snippet shell "Nix shell template" b
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
mkShell {
buildInputs = [
${1}
];
}
endsnippet
snippet mkDerivation "Shorthand for stdenv.mkDerivation" b
{ stdenv, lib, $1 }:
stdenv.mkDerivation rec {
$2
}
endsnippet
snippet buildGoModule "Shorthand for building Go modules" b
{ stdenv, lib, buildGoModule, $1 }:
buildGoModule rec {
pname = $1;
version = $2;
vendorSha256 = "";
}
endsnippet
snippet homeManagerModule "A file template for " <flags>
{ config, options, lib, pkgs, ... }:
let
cfg = config.$1;
in {
options.$1 = {
enable = lib.mkEnableOption "$2";
};
config = lib.mkIf cfg.enable {
};
}
endsnippet
snippet mkOption "lib.mkOption from nixpkgs" i
lib.mkOption {
type = $1;
description = $2;
default = $3;
example = $4;
$5
}
endsnippet

View File

@ -1,74 +0,0 @@
# Text formatting
snippet p "Paragraph" bi
.PP
$0
endsnippet
snippet bf "Boldface" iw
.ft B
$1
.ft
$0
endsnippet
snippet it "Italic" iw
.ft I
$1
.ft
$0
endsnippet
snippet bfit "Boldface italic" iw
.ft BI
$1
.ft
$0
endsnippet
# Document structures
snippet title "Title header" bi
.TH ${1:TITLE} ${2:SECTION} ${3:EXTRA}
$0
endsnippet
snippet sect "Sectioned (unnumbered) headers" bi
.SH ${1:SECTION NAME}
$0
endsnippet
snippet ss "Subsectioned (unnumbered) headers" bi
.SS ${1:SUBSECTION NAME}
$0
endsnippet
snippet ol "Ordered list setup" bi
.nr step 1 1
.IP \n+[step]
$1
$0
endsnippet
snippet oli "Ordered list item" bi
.IP \n+[step]
$1
$0
endsnippet
snippet uli "Unordered list item" bi
.IP \[bu]
$1
$0
endsnippet
snippet dl "Definition-style list item" bi
.IP ${1:WORD}
${2:DESCRIPTION}
$0
endsnippet
snippet eq "Equation" bi
.EQ
${1:EQUATION}
.EN
endsnippet

View File

@ -1,72 +0,0 @@
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
snippet def "Define function with autocompleting docstrings" iw
def ${1:function_name}($2):
"""
${3:To be defined}
`!p
arguments = [ arg.strip() for arg in t[2].split(',') if arg != "self" or len(arg.strip()) > 0 ]
# Format the string with an indent.
snip >> 1
for arg in arguments:
split_arg = arg.split('=')
param = split_arg[0].strip()
if param:
snip += f":param: {param} - @TODO"
`
"""
endsnippet
# Quickly create a class definition.
# This is inspired from the demo GIF from the official GitHub page at https://github.com/sirver/UltiSnips.
snippet class "Class keyword with autocompleting docstrings" iw
class ${1:PICK_A_NAME_CLASS}`!p snip.rv = smart_space(t[2], '(', loose=True)`$2`!p snip.rv = smart_space(t[2], ')', loose=True)`:
""" ${3:Docstring for $1} """
def __init__(${4:self}):
"""
${5:Creates an instance of $1}
`!p
arguments = [ arg.strip() for arg in t[4].split(',') if arg != "self" or len(arg.strip()) > 0 ]
# Format the string with an indent.
snip >> 2
for arg in arguments:
split_arg = arg.split('=')
param = split_arg[0].strip()
if param:
snip += f":param: {param} - @TODO"
`
"""
`!p
# Shift by two indentation level
snip >> 2
snip += "" if not t[2] else f"{t[2]}.__init__(self)"
`
$6
endsnippet
snippet if_main "If __main__" biw
if __name__ == "__main__":
${1:print("Hello world!")}
endsnippet

View File

@ -1,54 +0,0 @@
snippet if "If statement" iw
if [[ ${1:<condition>} ]]; then
${2:<expression>}
fi
endsnippet
snippet while_shift "A dependency-less option parser" iw
while [[ $# -gt 0 ]]; then
do
case $1 in
-h|--help)
echo "$help_section"
exit 0
;;
$2
esac
done
endsnippet
snippet if "If conditional" iw
if ${1:<expression>}; then
${2:<expression>}
fi
endsnippet
snippet while "While loop" iw
while ${1:<expression>};
do
${2:<expression>}
done
endsnippet
snippet select "Select loop stuff" iw
select ${1:<VARIABLE_NAME>} in ${2:foo bar baz}
do
${3:# Your stuff here}
done
$0
endsnippet
snippet getopts "An argument parser with getopts" iw
while getopts ${1:<OPTSTRING>} ${2:arg}
do
case ${2:"h"} in
h)
echo $_help
exit 0
*)
echo $_help
exit 0
esca
done
endsnippet

View File

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

File diff suppressed because it is too large Load Diff