Update polybar and UltiSnips snippets

This commit is contained in:
foo-dogsquared 2020-04-19 00:43:32 +08:00
parent 3df3e71c52
commit 67f893804f
3 changed files with 37 additions and 10 deletions

View File

@ -1,7 +1,7 @@
global !p global !p
from datetime import datetime, timedelta from datetime import datetime, timedelta
def relative_date(days): def relative_date(days = 0):
time_difference = timedelta(days=int(days)) time_difference = timedelta(days=int(days))
calculated_date = datetime.today() + time_difference calculated_date = datetime.today() + time_difference
@ -24,12 +24,18 @@ snip.rv = datetime.today().strftime("%F")
` `
endsnippet endsnippet
# Quick formatting.
snippet sign "Quick signature" i snippet sign "Quick signature" i
${1:Sincerely,} ${1:Sincerely,}
${2:Gabriel Arazas} ${2:Gabriel Arazas}
$0 $0
endsnippet 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 snippet ie "Parenthetical material Latin 'id est' (ie)" iw
(i.e., $1) $0 (i.e., $1) $0
endsnippet endsnippet
@ -38,6 +44,8 @@ snippet eg "Parenthetical material Latin 'exempli gratia' (eg)" iw
(e.g., $1) $0 (e.g., $1) $0
endsnippet endsnippet
# Em dashes (I've these dedicated snippets for some reason).
snippet em "Quick em dash" snippet em "Quick em dash"
endsnippet endsnippet
@ -54,6 +62,7 @@ snippet em-eg "'exempli gratia' surrounded with em dash" iw
— e.g., $1 — $0 — e.g., $1 — $0
endsnippet endsnippet
# Quick word snippets # Quick word snippets
# Each of these quick word snippets has a prefix of `qw-` # Each of these quick word snippets has a prefix of `qw-`
snippet qw-lx "LaTeX" iw snippet qw-lx "LaTeX" iw
@ -64,6 +73,7 @@ snippet qw-as "Asciidoctor" iw
Asciidoctor Asciidoctor
endsnippet endsnippet
# Miscellaneous snippets # Miscellaneous snippets
snippet #! "Quick snippet for a shebang." bi snippet #! "Quick snippet for a shebang." bi
#!${1:/usr/bin/env} ${2:sh} #!${1:/usr/bin/env} ${2:sh}

View File

@ -121,14 +121,13 @@ $0
endsnippet endsnippet
snippet "-table h (\d+)-" "Make a quick table with the headers already set up" bir snippet "-table h (\d+)-" "Make a quick table with the headers already set up" bir
[cols="`!p snip.rv = match.group(1)`", options="headers"] [cols="`!p snip.rv = match.group(1)`", options="headers"`!p snip.rv=smart_space(t[1], ", ", loose=True)`$1]
|=== |===
$1
`!p `!p
number_of_headers = int(match.group(1)) number_of_headers = int(match.group(1))
for i in range(0, number_of_headers): for i in range(0, number_of_headers):
snip.rv += f"| Header {i + 1}\n" snip += f"| Header {i + 1}"
` `
$2 $2
@ -180,6 +179,14 @@ $1
$0 $0
endsnippet endsnippet
snippet verbatim "Literal text block" bi
....
$1
....
$0
endsnippet
snippet sidebar "Sidebar as an open block" bi snippet sidebar "Sidebar as an open block" bi
[sidebar] [sidebar]
.${1:<title>} .${1:<title>}
@ -197,10 +204,16 @@ endsnippet
snippet append "Appendix block" bi snippet append "Appendix block" bi
[appendix] [appendix]
== ${1:Appendix} == ${1:Additional readings}
$0 $0
endsnippet endsnippet
snippet bibres "Bibliographical resource in a definition block" bi
${1:<link>}[${2:<title>}] (retrieved ${3:date})::
${4:<description>}
endsnippet
snippet stem "Stem block" bi snippet stem "Stem block" bi
[stem] [stem]
++++ ++++

View File

@ -126,7 +126,7 @@
inherit = module-common-style inherit = module-common-style
type = internal/network type = internal/network
interface = enp4s0 interface = enp4s0
interval = 3.0 interval = 3
format-connected-prefix = "ETH" format-connected-prefix = "ETH"
format-connected-prefix-padding = 1 format-connected-prefix-padding = 1
@ -134,13 +134,17 @@
format-connected-prefix-background = ${colors.network_module_bg} format-connected-prefix-background = ${colors.network_module_bg}
format-connected-background = ${colors.foreground} format-connected-background = ${colors.foreground}
format-connected-foreground = ${colors.background} format-connected-foreground = ${colors.background}
label-connected = OK label-connected = "OK"
label-connected-padding = 1 label-connected-padding = 1
format-disconnected = <label-disconnected> format-disconnected-prefix = "ETH"
format-disconnected-background = ${colors.background} format-disconnected-prefix-padding = 1
format-disconnected-prefix-foreground = ${colors.background}
format-disconnected-prefix-background = ${colors.network_module_bg}
format-disconnected-background = ${colors.foreground}
format-disconnected-foreground = ${colors.background}
label-disconnected-padding = 1 label-disconnected-padding = 1
label-disconnected = N/A label-disconnected = "N/A"
label-disconnected-foreground = ${colors.foreground} label-disconnected-foreground = ${colors.foreground}