From ab56c08ce57467e0c777e4dfca69e82a048af2b9 Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Thu, 28 Sep 2023 21:14:30 -0600 Subject: [PATCH] rename everything hehe --- groff/apa.tmac | 30 ++++++++++++++++++++++++++++++ groff/aparef | 30 ------------------------------ groff/bottomnum | 2 -- groff/{spanish => es.tmac} | 18 ++++++++---------- groff/{math => math.tmac} | 16 +++++++--------- groff/{markdown => md.tmac} | 8 ++++---- groff/pdfutils | 4 ---- groff/{report => report.tmac} | 0 groff/rmheadfoot | 7 ------- groff/{toc => toc.tmac} | 0 groff/utils | 17 ----------------- groff/utils.tmac | 22 ++++++++++++++++++++++ scripts/snip | 24 ++++++++++++++++++++++++ 13 files changed, 95 insertions(+), 83 deletions(-) create mode 100644 groff/apa.tmac delete mode 100644 groff/aparef delete mode 100644 groff/bottomnum rename groff/{spanish => es.tmac} (84%) rename groff/{math => math.tmac} (91%) rename groff/{markdown => md.tmac} (99%) delete mode 100644 groff/pdfutils rename groff/{report => report.tmac} (100%) delete mode 100644 groff/rmheadfoot rename groff/{toc => toc.tmac} (100%) delete mode 100644 groff/utils create mode 100644 groff/utils.tmac create mode 100755 scripts/snip diff --git a/groff/apa.tmac b/groff/apa.tmac new file mode 100644 index 0000000..352bcdb --- /dev/null +++ b/groff/apa.tmac @@ -0,0 +1,30 @@ +.\" Taken from /usr/share/groff/current/tmac +.\" Here is the specification of the five possible reference styles +.\" provided by 'refer'. The example entries are taken from the ms +.\" macro package. +.\" +.\" ref*spec!0 Q A T S V N P I C D O -- other +.\" ref*spec!1 Q A T J S V N P I C D O -- journal article +.\" ref*spec!2 Q A T S V P I C D O -- book +.\" ref*spec!3 Q A T B E S V P I C D O -- article within book +.\" ref*spec!4 Q A T R G P I C D O -- technical report +.\" +.\" Here I rearrrange items to match APA format +.ds ref*spec!0 Q A D T S V N P I C O +.ds ref*spec!1 Q A D T J S V N P I C O +.ds ref*spec!2 Q A D T S V P I C O +.ds ref*spec!3 Q A D T B E S V P I C O +.ds ref*spec!4 Q A D T R G P I C O +. +.\" This swaps a comma for a dot after the date +.ds ref*spec!T:0 ". " " "\fI" "" "\fP" +.ds ref*spec!T ". " " "\\*Q" "" "\\*U" +. +.\" Common options +.R1 +label "(A.n|Q) ', ' (D.y|D)"; bracket-label " (" ) "; " +join-authors ", " ", " +no-label-in-reference +date-as-label +accumulate +.R2 diff --git a/groff/aparef b/groff/aparef deleted file mode 100644 index 2e2063a..0000000 --- a/groff/aparef +++ /dev/null @@ -1,30 +0,0 @@ -\" Taken from /usr/share/groff/current/tmac -\" Here is the specification of the five possible reference styles -\" provided by 'refer'. The example entries are taken from the ms -\" macro package. -\" -\" ref*spec!0 Q A T S V N P I C D O -- other -\" ref*spec!1 Q A T J S V N P I C D O -- journal article -\" ref*spec!2 Q A T S V P I C D O -- book -\" ref*spec!3 Q A T B E S V P I C D O -- article within book -\" ref*spec!4 Q A T R G P I C D O -- technical report -\" -\" Here I rearrrange items to match APA format -.ds ref*spec!0 Q A D T S V N P I C O -.ds ref*spec!1 Q A D T J S V N P I C O -.ds ref*spec!2 Q A D T S V P I C O -.ds ref*spec!3 Q A D T B E S V P I C O -.ds ref*spec!4 Q A D T R G P I C O - -\" This swaps a comma for a dot after the date -.ds ref*spec!T:0 ". " " "\fI" "" "\fP" -.ds ref*spec!T ". " " "\\*Q" "" "\\*U" - -\" Common options -.R1 -label "(A.n|Q) ', ' (D.y|D)"; bracket-label " (" ) "; " -join-authors ", " ", " -no-label-in-reference -date-as-label -accumulate -.R2 diff --git a/groff/bottomnum b/groff/bottomnum deleted file mode 100644 index fca9ea1..0000000 --- a/groff/bottomnum +++ /dev/null @@ -1,2 +0,0 @@ -.ds CH -.ds CF -\En[PN]- diff --git a/groff/spanish b/groff/es.tmac similarity index 84% rename from groff/spanish rename to groff/es.tmac index b816e6e..315eee4 100644 --- a/groff/spanish +++ b/groff/es.tmac @@ -1,12 +1,10 @@ -\" Redefinición de registros comunes -\" para títulos y fechas en español. - -.ds DY \n[dy] de \*[MO] de \n[year] - +.\" Redefinición de registros comunes +.\" para títulos y fechas en español. +. .ds ABSTRACT RESUMEN - .ds TOC Tabla de contenido - +.ds REFERENCES Referencias +. .ds MONTH1 enero .ds MONTH2 febrero .ds MONTH3 marzo @@ -19,9 +17,9 @@ .ds MONTH10 octubre .ds MONTH11 noviembre .ds MONTH12 diciembre - -.ds REFERENCES Referencias - +. +.ds DY \n[dy] de \*[MO] de \n[year] +. .EQ define sen 'roman "sen"' define senh 'roman "senh"' diff --git a/groff/math b/groff/math.tmac similarity index 91% rename from groff/math rename to groff/math.tmac index 8bb1844..7882c76 100644 --- a/groff/math +++ b/groff/math.tmac @@ -1,6 +1,6 @@ \" Quality of life utilities \" for easier eqn usage. - +. .EQ delim $$ define / 'over' @@ -18,7 +18,6 @@ define and '{~ \[AN] ~}' define div '{~ \[di] ~}' define <<< '{~ \[<<] ~}' define >>> '{~ \[>>] ~}' - define sen 'roman "sen"' define tan 'roman "tan"' define sec 'roman "sec"' @@ -44,9 +43,9 @@ define arccosh 'roman "arccosh"' define arccoth 'roman "arccoth"' define arccsch 'roman "arccsch"' .EN - -\" From eqn manual, draws a diagonal -\" line through an expression +. +.\" From eqn manual, draws a diagonal +.\" line through an expression .EQ define cancel 'special Ca' .EN @@ -57,9 +56,9 @@ define cancel 'special Ca' \D'l \\n(0wu -\\n(0hu-\\n(0du'\ \v'\\n(0hu' .. - -\" From eqn manual, draws a box -\" round an expression +. +.\" From eqn manual, draws a box +.\" round an expression .EQ define box 'special Bx' .EN @@ -78,4 +77,3 @@ define box 'special Bx' . nr 0d +1n . nr 0h +1n .. - diff --git a/groff/markdown b/groff/md.tmac similarity index 99% rename from groff/markdown rename to groff/md.tmac index fd29f9b..d093a90 100644 --- a/groff/markdown +++ b/groff/md.tmac @@ -1,6 +1,6 @@ \" Markdown-like syntax for custom headings \" and other text formatting options. - +. \" --- Headings --- .de # . nf @@ -65,7 +65,7 @@ \h'0n'\v'-1.2n' . fi .. - +. \" --- Lists --- .de * . IP \(bu 2 @@ -79,14 +79,14 @@ . IP \(bu 2 \\$1 .. - +. \" --- Block quotes --- .de > . QP . I . ad b .. - +. \" --- Horizontal rule --- .de --- \l'\\n(.lu\(ul' diff --git a/groff/pdfutils b/groff/pdfutils deleted file mode 100644 index 571d4a1..0000000 --- a/groff/pdfutils +++ /dev/null @@ -1,4 +0,0 @@ -\# These lines set link text and border colours -.ds PDFHREF.COLOUR #193be5 -.defcolor pdf:href.colour rgb \*[PDFHREF.COLOUR] -.ds PDFHREF.TEXT.COLOUR pdf:href.colour diff --git a/groff/report b/groff/report.tmac similarity index 100% rename from groff/report rename to groff/report.tmac diff --git a/groff/rmheadfoot b/groff/rmheadfoot deleted file mode 100644 index 312816f..0000000 --- a/groff/rmheadfoot +++ /dev/null @@ -1,7 +0,0 @@ -\" Remove page headers and footers -.ds LH -.ds CH -.ds RH -.ds LF -.ds CF -.ds RF diff --git a/groff/toc b/groff/toc.tmac similarity index 100% rename from groff/toc rename to groff/toc.tmac diff --git a/groff/utils b/groff/utils deleted file mode 100644 index 4f2cf02..0000000 --- a/groff/utils +++ /dev/null @@ -1,17 +0,0 @@ -\" Print a rule as long as specified -\" in the first argument -.de rule -\D'l \\$1 0' -.. - -\" Auto-numbered equation: \\n+[eqnnum] -\" Current equation: \\n[eqnnum] -.nr eqnnum 0 1 - -\" Auto-numbered figures: \\n+[fignum] -\" Current figure: \\n[fignum] -.nr fignum 0 1 - -\" Auto-numbered tables: \\n+[tblnum] -\" Current table: \\n[tblnum] -.nr tblnum 0 1 diff --git a/groff/utils.tmac b/groff/utils.tmac new file mode 100644 index 0000000..90ad720 --- /dev/null +++ b/groff/utils.tmac @@ -0,0 +1,22 @@ +.\" These lines set link text and border colours +.ds PDFHREF.COLOUR #193be5 +.defcolor pdf:href.colour rgb \*[PDFHREF.COLOUR] +.ds PDFHREF.TEXT.COLOUR pdf:href.colour +. +.\" Print a rule as long as specified +.\" in the first argument +.de rule +\D'l \\$1 0' +.. +. +.\" Auto-numbered equation: \\n+[eqnnum] +.\" Current equation: \\n[eqnnum] +.nr eqnnum 0 1 +. +.\" Auto-numbered figures: \\n+[fignum] +.\" Current figure: \\n[fignum] +.nr fignum 0 1 +. +.\" Auto-numbered tables: \\n+[tblnum] +.\" Current table: \\n[tblnum] +.nr tblnum 0 1 diff --git a/scripts/snip b/scripts/snip new file mode 100755 index 0000000..5fbd89e --- /dev/null +++ b/scripts/snip @@ -0,0 +1,24 @@ +#!/bin/sh +# Snippets directory +snippets=~/Documents/snippets + +# Navigate using fzf +fzf_nav() { +[ -d "$1" ] && cd "$1" +while true ; do + opt=$(/usr/bin/ls -AF1 --group-directories-first) + opt=$(printf "../\n$opt" | fzf --cycle --reverse --padding 2% --preview 'batcat --decorations never --color always {}') + [ -d "$opt" ] && cd "$opt" > /dev/null 2>&1 || break +done +[ -n "$opt" ] && echo "$opt" +} + +# Select using menu +snippet=$(fzf_nav "$snippets") +# Exit if empty +[ -z "$snippet" ] && exit + +# Copy to clipboard and notify +cat "$snippets"/"$snippet" | xsel -ib && notify-send "Snippet" "'$snippet' copied to clipboard!" + +"$EDITOR" "$snippets"/"$snippet"