mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 22:57:55 +00:00
3a022a374a
I think this is better for separating modules explicitly. This is also considered as there are similar objects between modules (e.g., NixOS and home-manager modules and users). Revert users module to old position
108 lines
2.3 KiB
Plaintext
Executable File
108 lines
2.3 KiB
Plaintext
Executable File
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)]`
|
||
$0
|
||
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) + '┘'`
|
||
$0
|
||
endsnippet
|
||
|